mirror of
https://github.com/Sea-Haven-Industries/shoc-backend.git
synced 2026-09-30 07:13:12 +00:00
Reactive/Emergency work orders with a SEV 1-5 level are timed from their
creation against the SEV Respond deadline (2/4/8/24/72 hours, one backend
table). From 50% they are at risk: a dismissable High row in the "SLA at
Risk" section and an entry in the feed's slaAtRisk set with the server
clock (start, deadline, percent) for the banner and toast. From 100% they
are a Critical acknowledge row that only acknowledging removes.
POST /api/notifications/sla/{id}/acknowledge records who and when as a
work-order audit entry ("SLA breach acknowledged by <name>"), scoped to the
caller's feed audience: 404 outside it, 409 before the deadline, 204 when
recorded or already recorded. A later severity change is a new breach.
69 lines
4 KiB
C#
69 lines
4 KiB
C#
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);
|
||
|
||
/// <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);
|
||
|
||
/// <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);
|
||
}
|
||
}
|