case 4763 - backup sets to keep must be at least 1

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-31 16:11:20 -07:00
parent c52273f284
commit 393a60c57d
4 changed files with 16 additions and 5 deletions

View File

@@ -79,9 +79,15 @@ namespace AyaNova.Api.Controllers
GlobalOpsBackupSettingsBiz biz = GlobalOpsBackupSettingsBiz.GetBiz(ct, HttpContext);
if (!Authorized.HasModifyRole(HttpContext.Items, biz.BizType))
return StatusCode(403, new ApiNotAuthorizedResponse());
var o = await biz.PutAsync(updatedObject);
var o = await biz.PutAsync(updatedObject);
if (o == null)
return StatusCode(409, new ApiErrorResponse(biz.Errors));
{
//case 4763: the settings can now fail validation, which is not a concurrency conflict
if (biz.Errors.Exists(z => z.Code == ApiErrorCode.CONCURRENCY_CONFLICT))
return StatusCode(409, new ApiErrorResponse(biz.Errors));
else
return BadRequest(new ApiErrorResponse(biz.Errors));
}
return Ok(ApiOkResponse.Response(new { Concurrency = o.Concurrency }));
}

View File

@@ -112,8 +112,12 @@ namespace AyaNova.Biz
//Can save or update?
private void Validate(GlobalOpsBackupSettings inObj)
{
//currently nothing to validate
#if (!SUBSCRIPTION_BUILD)
//case 4763: at least the newest backup is always kept, so fewer than 1 is not a setting (it was treated as 1)
//the subscription build always keeps 1 and its form doesn't show this setting
if (inObj.BackupSetsToKeep < 1)
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "BackupSetsToKeep");
#endif
}