fix(work-orders): name Schedule On in PastDueStatusBlocked and register SH-121 no-op

The 422 still told dispatchers to update Due Date. Point the remedy at Schedule On and make the SH-121 successor visible to EF so G6 lineage is complete.
This commit is contained in:
Arthur Bassi 2026-08-18 09:19:27 -03:00
parent c9a80f5c79
commit 4760f3fdd7
3 changed files with 9 additions and 1 deletions

View file

@ -1,3 +1,5 @@
using Data.SeaHavenIndustries;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
@ -10,6 +12,8 @@ namespace Data.SeaHavenIndustries.Migrations
/// now live in <c>20260730150000_WoIsAddOn</c> (SH-184). This migration is a no-op so
/// both PRs can land without a duplicate column.
/// </summary>
[DbContext(typeof(ApplicationDbContext))]
[Migration("20260813193000_SH121_BoardSearchFacets")]
public partial class SH121_BoardSearchFacets : Migration
{
/// <inheritdoc />

View file

@ -63,7 +63,7 @@ namespace SeaHaven.Services.Implementation
var isPastDue = WorkOrderDerivedFields.IsPastDue(workOrder.ScheduledDate, workOrder.LifecycleStatus);
if (WorkOrderBoardMutationRules.ShouldBlockStatusChangeWhenPastDue(canonicalField, isPastDue))
throw new WorkOrderBoardValidationException("PastDueStatusBlocked", "Status cannot be changed while work order is past due. Update due date first.");
throw new WorkOrderBoardValidationException("PastDueStatusBlocked", "Status cannot be changed while work order is past due. Update Schedule On first.");
_mutationData.SetExpectedWorkOrderVersion(workOrder, workOrderVersion);

View file

@ -111,6 +111,8 @@ public class WorkOrderBoardUpdateServiceTests
}, "actor-1"));
Assert.Equal("PastDueStatusBlocked", ex.Code);
Assert.Contains("Schedule On", ex.Message, StringComparison.Ordinal);
Assert.DoesNotContain("due date", ex.Message, StringComparison.OrdinalIgnoreCase);
}
[Fact]
@ -187,6 +189,8 @@ public class WorkOrderBoardUpdateServiceTests
}, "actor-1"));
Assert.Equal("PastDueStatusBlocked", ex.Code);
Assert.Contains("Schedule On", ex.Message, StringComparison.Ordinal);
Assert.DoesNotContain("due date", ex.Message, StringComparison.OrdinalIgnoreCase);
}
[Fact]