shoc-backend/SeaHaven.DataServices/Interfaces/IWorkOrderWebhookDataService.cs
Arthur Bassi 1edcf479ae fix(work-orders): apply account scope across create and reads [SH-221]
Stamp WorkOrder.AccountId on all create paths and filter board/list/search/detail by server-derived account claims so scoped callers cannot cross accounts.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-11 10:45:37 -03:00

60 lines
2.4 KiB
C#

using Data.SeaHavenIndustries.Enums;
namespace SeaHaven.DataServices.Interfaces
{
public interface IWorkOrderWebhookDataService
{
Task<WorkOrderWebhookPersistenceResult> ApplyAsync(
WorkOrderWebhookMutation mutation,
CancellationToken cancellationToken);
}
public sealed record WorkOrderWebhookMutation
{
public required string DeliveryId { get; init; }
public required string EventType { get; init; }
public required DateTimeOffset OccurredAt { get; init; }
public required DateTimeOffset ProcessedAt { get; init; }
public required string BodySha256 { get; init; }
public required string ExternalWorkOrderId { get; init; }
public required string WorkerOrderNumber { get; init; }
public required string Source { get; init; }
public required DateTimeOffset UpdatedAt { get; init; }
public required string VersionHash { get; init; }
public bool IsStateEvent { get; init; }
public bool IsCancelled { get; init; }
public string? Title { get; init; }
public string? Description { get; init; }
public string? Status { get; init; }
public LifecycleStatus? LifecycleStatus { get; init; }
public string? Severity { get; init; }
public string? Priority { get; init; }
public string? AssignedTo { get; init; }
public string? RecordType { get; init; }
public string? SourceEmailS3Key { get; init; }
public string? Customer { get; init; }
public string? SiteCode { get; init; }
public string? Building { get; init; }
public string? Address { get; init; }
public DateTime? DueDate { get; init; }
public DateTime? DateReported { get; init; }
public DateTime? ScheduledStart { get; init; }
public DateTime? CreatedAt { get; init; }
public string? CommentId { get; init; }
public string? CommentText { get; init; }
public string? Commenter { get; init; }
public string? CommentType { get; init; }
}
public enum WorkOrderWebhookPersistenceStatus
{
Applied,
Duplicate,
HashConflict,
AccountUnresolved
}
public sealed record WorkOrderWebhookPersistenceResult(
WorkOrderWebhookPersistenceStatus Status,
bool StateMutationSkipped = false);
}