From c9d8bdfda6ba4645c303127f5f0971444f27a5c1 Mon Sep 17 00:00:00 2001 From: Eduardo Lopes <155753879+eduardolopesx03@users.noreply.github.com> Date: Tue, 27 Jan 2026 17:22:20 -0300 Subject: [PATCH] Null vigencia notification links before delete --- Controllers/LinesController.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Controllers/LinesController.cs b/Controllers/LinesController.cs index cdfa4ea..028206f 100644 --- a/Controllers/LinesController.cs +++ b/Controllers/LinesController.cs @@ -1177,6 +1177,16 @@ namespace line_gestao_api.Controllers var lastRow = ws.LastRowUsed()?.RowNumber() ?? startRow; var tenantId = GetTenantIdFromClaims(); + var notificationsQuery = _db.Notifications + .IgnoreQueryFilters() + .Where(n => n.VigenciaLineId != null); + if (tenantId.HasValue) + { + notificationsQuery = notificationsQuery.Where(n => n.TenantId == tenantId.Value); + } + await notificationsQuery.ExecuteUpdateAsync(setters => + setters.SetProperty(n => n.VigenciaLineId, n => null)); + var vigenciaQuery = _db.VigenciaLines.IgnoreQueryFilters(); if (tenantId.HasValue) {