From 01568baf4fff7b8c15e3dcdc3309a2c928b16b20 Mon Sep 17 00:00:00 2001 From: nns Date: Tue, 26 May 2026 11:53:32 +0500 Subject: [PATCH] =?UTF-8?q?fix(superadmin):=20change-owner=20=D1=82=D1=80?= =?UTF-8?q?=D0=B5=D0=B1=D1=83=D0=B5=D1=82=20reason=20=E2=89=A5=2010=20?= =?UTF-8?q?=D1=81=D0=B8=D0=BC=D0=B2=D0=BE=D0=BB=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Смена владельца организации писала reason в журнал аудита, но проверяла лишь его непустоту — короткие/мусорные причины («ok») проходили. PlatformSettings для SMTP уже требует ≥10 символов; приводим change-owner к той же планке (ТЗ 2.8: «Reason < 10 символов → 400»), чтобы журнал аудита оставался осмысленным. Co-Authored-By: Claude Opus 4.7 --- .../SuperAdmin/SuperAdminOrganizationsController.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 = "Пользователь не найден или не принадлежит этой организации." });