diff --git a/src/food-market.api/Controllers/SuperAdmin/SuperAdminOrganizationsController.cs b/src/food-market.api/Controllers/SuperAdmin/SuperAdminOrganizationsController.cs index c7e0ed4..158fa36 100644 --- a/src/food-market.api/Controllers/SuperAdmin/SuperAdminOrganizationsController.cs +++ b/src/food-market.api/Controllers/SuperAdmin/SuperAdminOrganizationsController.cs @@ -234,7 +234,8 @@ public async Task ChangeOwner(Guid id, [FromBody] ChangeOwnerRequ { var o = await _db.Organizations.IgnoreQueryFilters().FirstOrDefaultAsync(x => x.Id == id, ct); if (o is null) return NotFound(); - if (string.IsNullOrWhiteSpace(req.Reason)) return BadRequest(new { error = "Reason required." }); + if (string.IsNullOrWhiteSpace(req.Reason) || req.Reason.Trim().Length < 10) + return BadRequest(new { error = "Причина смены владельца обязательна (≥ 10 символов) — она пишется в журнал аудита." }); var user = await _userMgr.FindByIdAsync(req.NewOwnerUserId.ToString()); if (user is null || user.OrganizationId != o.Id) return BadRequest(new { error = "Пользователь не найден или не принадлежит этой организации." });