mirror of
https://github.com/Sea-Haven-Industries/shoc-backend.git
synced 2026-09-30 20:03:11 +00:00
Enforce MIME/extension/magic-byte validation, auth and workOrderVersion concurrency, audit on category changes, and validate-before-store with blob compensate.
97 lines
3.4 KiB
C#
97 lines
3.4 KiB
C#
namespace SeaHaven.Services.Helpers
|
|
{
|
|
public static class WorkOrderBoardFieldNames
|
|
{
|
|
public const string WoNumber = "woNumber";
|
|
public const string WorkOrderType = "workOrderType";
|
|
public const string SiteCode = "siteCode";
|
|
public const string LifecycleStatus = "lifecycleStatus";
|
|
public const string AssignTo = "assignTo";
|
|
public const string DueDate = "dueDate";
|
|
public const string ScheduledDate = "scheduledDate";
|
|
public const string TargetWeek = "targetWeek";
|
|
public const string ScheduleWeekOnly = "scheduleWeekOnly";
|
|
public const string VendorId = "vendorId";
|
|
public const string ApptDate = "apptDate";
|
|
public const string ApptTime = "apptTime";
|
|
public const string DocStatus = "docStatus";
|
|
public const string CompletedDate = "completedDate";
|
|
public const string Pm = "pm";
|
|
public const string ServiceNotes = "serviceNotes";
|
|
public const string ExtraServices = "extraServices";
|
|
public const string FlagColor = "flagColor";
|
|
public const string RescheduleCount = "RescheduleCount";
|
|
|
|
private static readonly HashSet<string> DispatchFields = new(StringComparer.OrdinalIgnoreCase)
|
|
{
|
|
VendorId,
|
|
ApptDate,
|
|
ApptTime
|
|
};
|
|
|
|
private static readonly HashSet<string> AllEditable = new(StringComparer.OrdinalIgnoreCase)
|
|
{
|
|
WoNumber,
|
|
WorkOrderType,
|
|
SiteCode,
|
|
LifecycleStatus,
|
|
AssignTo,
|
|
DueDate,
|
|
ScheduledDate,
|
|
TargetWeek,
|
|
ScheduleWeekOnly,
|
|
VendorId,
|
|
ApptDate,
|
|
ApptTime,
|
|
DocStatus,
|
|
CompletedDate,
|
|
Pm,
|
|
ServiceNotes,
|
|
ExtraServices,
|
|
FlagColor
|
|
};
|
|
|
|
public static bool IsEditable(string field) => Canonicalize(field) != null;
|
|
|
|
public static bool IsDispatchField(string field)
|
|
{
|
|
var canonical = Canonicalize(field);
|
|
return canonical != null && DispatchFields.Contains(canonical);
|
|
}
|
|
|
|
public static string? Canonicalize(string field)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(field))
|
|
return null;
|
|
|
|
return AllEditable.FirstOrDefault(f => string.Equals(f, field, StringComparison.OrdinalIgnoreCase));
|
|
}
|
|
|
|
public static string ToAuditFieldName(string field)
|
|
{
|
|
var canonical = Canonicalize(field) ?? field;
|
|
return canonical switch
|
|
{
|
|
WoNumber => "InternalWONumber",
|
|
WorkOrderType => "WorkOrderType",
|
|
SiteCode => "SiteCode",
|
|
LifecycleStatus => "LifecycleStatus",
|
|
AssignTo => "AssignTo",
|
|
DueDate => "DueDate",
|
|
ScheduledDate => "ScheduledDate",
|
|
TargetWeek => "TargetWeek",
|
|
ScheduleWeekOnly => "ScheduleWeekOnly",
|
|
VendorId => "VendorId",
|
|
ApptDate => "ApptDate",
|
|
ApptTime => "ApptTime",
|
|
DocStatus => "DocStatus",
|
|
CompletedDate => "CompletedDate",
|
|
Pm => "Trade",
|
|
ServiceNotes => "ServiceNotes",
|
|
ExtraServices => "ExtraServices",
|
|
FlagColor => "FlagColor",
|
|
_ => canonical
|
|
};
|
|
}
|
|
}
|
|
}
|