2026-09-18 12:40:33 -03:00
|
|
|
|
using SeaHaven.DataServices.Models;
|
|
|
|
|
|
|
|
|
|
|
|
namespace SeaHaven.DataServices.Interfaces
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Live work-order conditions behind the notification feed. Every query applies the
|
|
|
|
|
|
/// base scope (no templates, no deleted rows), the caller's account scope, and the
|
|
|
|
|
|
/// shared open rule (not Completed/Canceled, including legacy terminal statuses).
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public interface INotificationFeedDataService
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>Open work orders with no dispatcher assigned in <paramref name="accountId"/> (null is org-wide).</summary>
|
|
|
|
|
|
Task<UnassignedWorkOrdersSummary> GetUnassignedSummaryAsync(int? accountId, CancellationToken cancellationToken);
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Open, Aveta-required work orders scheduled on <paramref name="today"/> or the next day with no
|
|
|
|
|
|
/// Aveta document attached. Items are the <paramref name="limit"/> latest scheduled.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
Task<NotificationCandidatePage> GetAvetaMissingAsync(
|
|
|
|
|
|
NotificationFeedScope scope, DateOnly today, int limit, CancellationToken cancellationToken);
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Open work orders scheduled at or before <paramref name="cutoff"/> with no active vendor dispatch,
|
|
|
|
|
|
/// direct or linked. Items are the <paramref name="limit"/> latest scheduled.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
Task<NotificationCandidatePage> GetNoVendorAsync(
|
|
|
|
|
|
NotificationFeedScope scope, DateTime cutoff, int limit, CancellationToken cancellationToken);
|
2026-09-18 13:15:33 -03:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Open work orders assigned to the user whose latest assignment happened at or after
|
|
|
|
|
|
/// <paramref name="since"/> and was made by someone else, read from the latest AssignTo audit
|
|
|
|
|
|
/// entry (board create writes one too). Returns at most <paramref name="limit"/>, newest first.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
Task<IReadOnlyList<NotificationAssignmentCandidate>> GetRecentAssignmentsAsync(
|
|
|
|
|
|
NotificationPersonalScope scope, DateTime since, int limit, CancellationToken cancellationToken);
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Comments posted at or after <paramref name="since"/> by someone other than the user, on work orders
|
|
|
|
|
|
/// the user is assigned to, has commented on, or that mention the user, and that the user has not
|
|
|
|
|
|
/// commented after. Returns at most <paramref name="limit"/>, newest first.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
Task<IReadOnlyList<NotificationCommentCandidate>> GetUnansweredCommentsAsync(
|
|
|
|
|
|
NotificationPersonalScope scope, DateTime since, int limit, CancellationToken cancellationToken);
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Approve, reject and revoke decisions made at or after <paramref name="since"/> by someone else on
|
|
|
|
|
|
/// uplifts the user requested. Returns at most <paramref name="limit"/>, newest first.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
Task<IReadOnlyList<NotificationUpliftDecisionCandidate>> GetUpliftDecisionsAsync(
|
|
|
|
|
|
NotificationPersonalScope scope, DateTime since, int limit, CancellationToken cancellationToken);
|
2026-09-25 11:16:21 -03:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Open Reactive/Emergency work orders with a SEV 1–5 level, split by creation time: at risk when
|
|
|
|
|
|
/// created at or before <paramref name="atRisk"/> but after <paramref name="breached"/>, breached when
|
|
|
|
|
|
/// created at or before <paramref name="breached"/> and not yet acknowledged for their current level.
|
|
|
|
|
|
/// Breaches are the <paramref name="breachedLimit"/> newest; the at-risk set is bounded by the longest window.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
Task<NotificationSlaCandidates> GetSlaCandidatesAsync(
|
|
|
|
|
|
NotificationFeedScope scope,
|
|
|
|
|
|
NotificationSlaCutoffs atRisk,
|
|
|
|
|
|
NotificationSlaCutoffs breached,
|
|
|
|
|
|
int breachedLimit,
|
|
|
|
|
|
CancellationToken cancellationToken);
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>The work order as an SLA candidate inside <paramref name="scope"/>, or null when it is not one.</summary>
|
|
|
|
|
|
Task<NotificationSlaCandidate?> GetSlaCandidateAsync(
|
|
|
|
|
|
NotificationFeedScope scope, int workOrderId, CancellationToken cancellationToken);
|
2026-09-18 12:40:33 -03:00
|
|
|
|
}
|
|
|
|
|
|
}
|