mirror of
https://github.com/Sea-Haven-Industries/shoc-backend.git
synced 2026-09-30 03:43:11 +00:00
GET /dashboard/stats now returns unassigned: open (not Completed or Canceled) work orders with no dispatcher in the selected period, within the caller's server-derived account scope. It uses the same filters as the Unassigned board search, so the Dashboard number equals the list it drills into. A dispatcher-scoped Dashboard has no unassigned work and returns 0.
79 lines
2.5 KiB
C#
79 lines
2.5 KiB
C#
namespace SeaHaven.DataServices.Interfaces
|
|
{
|
|
using Data.SeaHavenIndustries.Enums;
|
|
|
|
public interface IDashboardDataService
|
|
{
|
|
Task<DashboardCounts> GetWorkOrderCountsAsync(
|
|
int? accountId,
|
|
CancellationToken cancellationToken);
|
|
|
|
Task<DashboardKpiCounts> GetKpiCountsAsync(
|
|
int? accountId,
|
|
string? dispatcherId,
|
|
DateOnly today,
|
|
CancellationToken cancellationToken);
|
|
|
|
/// <summary>
|
|
/// Open work orders with no dispatcher in the period, counted with the
|
|
/// same filters as GET /board/search for Dispatcher=Unassigned (SH-392),
|
|
/// so the Dashboard number matches the list it drills into.
|
|
/// </summary>
|
|
Task<int> CountOpenUnassignedAsync(
|
|
int? accountId,
|
|
string? dispatcherId,
|
|
DateOnly? dateFrom,
|
|
DateOnly? dateTo,
|
|
CancellationToken cancellationToken);
|
|
|
|
Task<IReadOnlyList<DashboardWorkOrder>> GetDashboardWorkOrdersAsync(
|
|
int? accountId,
|
|
string? dispatcherId,
|
|
DateOnly? dateFrom,
|
|
DateOnly? dateTo,
|
|
CancellationToken cancellationToken);
|
|
|
|
Task<IReadOnlyList<DashboardDispatcherWorkload>> GetDispatcherWorkloadAsync(
|
|
int? accountId,
|
|
string? dispatcherId,
|
|
DateOnly? dateFrom,
|
|
DateOnly? dateTo,
|
|
CancellationToken cancellationToken);
|
|
}
|
|
|
|
public sealed record DashboardWorkOrder(
|
|
int Id,
|
|
string? AssignTo,
|
|
WorkOrderType? WorkOrderType,
|
|
LifecycleStatus? LifecycleStatus,
|
|
string? LegacyStatus,
|
|
DateTime? ScheduledDate,
|
|
DateOnly? OriginalDate,
|
|
DateTime? CompletedDate,
|
|
string? LocationState = null,
|
|
int RescheduleCount = 0,
|
|
int? VendorCompanyId = null,
|
|
string? VendorCompanyName = null,
|
|
bool VendorIsActive = false,
|
|
bool VendorCompanyIsDeleted = false);
|
|
|
|
public sealed record DashboardDispatcherWorkload(
|
|
string DispatcherId,
|
|
string DispatcherName,
|
|
string? Color,
|
|
int TotalCount,
|
|
int OpenCount);
|
|
|
|
public class DashboardCounts
|
|
{
|
|
public int Total { get; set; }
|
|
public int Open { get; set; }
|
|
public int NotDispatched { get; set; }
|
|
public int Completed { get; set; }
|
|
}
|
|
|
|
public sealed record DashboardKpiCounts(
|
|
int ScheduledTomorrow,
|
|
int PendingUplifts,
|
|
int AvetaPending);
|
|
}
|