mirror of
https://github.com/Sea-Haven-Industries/shoc-backend.git
synced 2026-09-30 16:33:12 +00:00
The legacy ingest batch holds the per-work-order lock, taken in id order, for every work order it may cancel until the batch commits. A vendor uplift request now runs under the same lock. Uplift creation on both routes refuses a work order cancelled by either lifecycle or status text, so a request can neither slip past a cancel nor land after one.
26 lines
1.4 KiB
C#
26 lines
1.4 KiB
C#
using Data.SeaHavenIndustries;
|
|
|
|
namespace SeaHaven.DataServices.Interfaces
|
|
{
|
|
public interface IWorkOrderIngestDataService
|
|
{
|
|
Task<int> GetMaxWorkOrderIdAsync(CancellationToken cancellationToken);
|
|
Task<WorkOrder?> GetTrackedByExternalIdAsync(string externalWorkOrderId, CancellationToken cancellationToken);
|
|
void TrackWorkOrder(WorkOrder workOrder);
|
|
Task<Locations?> FindLocationAsync(string name, CancellationToken cancellationToken);
|
|
Task AddAndSaveLocationAsync(Locations location, CancellationToken cancellationToken);
|
|
// Stages (does not save) the sync-attributed cancellation of the work order's pending
|
|
// uplifts, each with its own audit row. See PendingUpliftCancellation.
|
|
Task<int> StageCancelPendingUpliftsAsync(int workOrderId, CancellationToken cancellationToken);
|
|
Task<IReadOnlyList<int>> GetWorkOrderIdsByExternalIdsAsync(
|
|
IReadOnlyCollection<string> externalWorkOrderIds,
|
|
CancellationToken cancellationToken);
|
|
// Runs the batch in one transaction, holding the per-work-order lock on
|
|
// lockedWorkOrderIds (see WorkOrderMutationLock) until it commits or rolls back.
|
|
Task ExecuteTransactionalAsync(
|
|
IReadOnlyCollection<int> lockedWorkOrderIds,
|
|
Func<CancellationToken, Task> work,
|
|
CancellationToken cancellationToken);
|
|
Task SaveAsync(CancellationToken cancellationToken);
|
|
}
|
|
}
|