mirror of
https://github.com/Sea-Haven-Industries/shoc-backend.git
synced 2026-10-07 16:19:07 +00:00
Align week presets to Mon-Fri, treat types=Other as past-due, expand text search, whitelist sortBy, and use 0-based paging for advanced search without breaking 1-based PagedResult consumers.
29 lines
852 B
C#
29 lines
852 B
C#
namespace SeaHaven.Services.Helpers
|
|
{
|
|
public static class WorkOrderBoardSortFields
|
|
{
|
|
public static readonly IReadOnlySet<string> Allowed = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
|
|
{
|
|
"scheduledDate",
|
|
"woNumber",
|
|
"dueDate"
|
|
};
|
|
|
|
public static string NormalizeOrThrow(string? sortBy)
|
|
{
|
|
var field = (sortBy ?? "scheduledDate").Trim();
|
|
if (!Allowed.Contains(field))
|
|
{
|
|
throw new ArgumentException(
|
|
"sortBy must be one of: scheduledDate, woNumber, dueDate.");
|
|
}
|
|
|
|
return field.ToLowerInvariant() switch
|
|
{
|
|
"wonumber" => "woNumber",
|
|
"duedate" => "dueDate",
|
|
_ => "scheduledDate"
|
|
};
|
|
}
|
|
}
|
|
}
|