Files
vigilcare-clinical/VigilCareClinicalAPI/Domains/Enums/AuditAction.cs
T
voltsrage 80b009fd23
CI / backend (push) Successful in 8m52s
CI / frontend (push) Failing after 1m39s
feature: Self-Service Clinical Testing Sessions
2026-08-06 04:03:04 +08:00

67 lines
3.0 KiB
C#

public enum AuditAction
{
ThresholdCreated,
ThresholdUpdated,
ThresholdDeleted,
AlertAcknowledged,
AlertResolved,
EncounterStatusChanged,
PatientRegistered,
PatientUpdated,
SuppressionWindowSet,
UserLogin,
AuthorizationDenied,
AlertFeedbackSubmitted,
UserLogout,
TokenRefreshed,
SimulationRunStarted,
SimulationRunStopped,
SimulationDataPurged,
}
public static class AuditActionExtensions
{
public static string ToDbString(this AuditAction a) => a switch
{
AuditAction.ThresholdCreated => "THRESHOLD_CREATED",
AuditAction.ThresholdUpdated => "THRESHOLD_UPDATED",
AuditAction.ThresholdDeleted => "THRESHOLD_DELETED",
AuditAction.AlertAcknowledged => "ALERT_ACKNOWLEDGED",
AuditAction.AlertResolved => "ALERT_RESOLVED",
AuditAction.EncounterStatusChanged => "ENCOUNTER_STATUS_CHANGED",
AuditAction.PatientRegistered => "PATIENT_REGISTERED",
AuditAction.PatientUpdated => "PATIENT_UPDATED",
AuditAction.SuppressionWindowSet => "SUPPRESSION_WINDOW_SET",
AuditAction.UserLogin => "USER_LOGIN",
AuditAction.AuthorizationDenied => "AUTHORIZATION_DENIED",
AuditAction.AlertFeedbackSubmitted => "ALERT_FEEDBACK_SUBMITTED",
AuditAction.UserLogout => "USER_LOGOUT",
AuditAction.TokenRefreshed => "TOKEN_REFRESHED",
AuditAction.SimulationRunStarted => "SIMULATION_RUN_STARTED",
AuditAction.SimulationRunStopped => "SIMULATION_RUN_STOPPED",
AuditAction.SimulationDataPurged => "SIMULATION_DATA_PURGED",
_ => throw new ArgumentOutOfRangeException(nameof(a))
};
public static AuditAction FromDbString(string v) => v switch
{
"THRESHOLD_CREATED" => AuditAction.ThresholdCreated,
"THRESHOLD_UPDATED" => AuditAction.ThresholdUpdated,
"THRESHOLD_DELETED" => AuditAction.ThresholdDeleted,
"ALERT_ACKNOWLEDGED" => AuditAction.AlertAcknowledged,
"ALERT_RESOLVED" => AuditAction.AlertResolved,
"ENCOUNTER_STATUS_CHANGED" => AuditAction.EncounterStatusChanged,
"PATIENT_REGISTERED" => AuditAction.PatientRegistered,
"PATIENT_UPDATED" => AuditAction.PatientUpdated,
"SUPPRESSION_WINDOW_SET" => AuditAction.SuppressionWindowSet,
"USER_LOGIN" => AuditAction.UserLogin,
"AUTHORIZATION_DENIED" => AuditAction.AuthorizationDenied,
"ALERT_FEEDBACK_SUBMITTED" => AuditAction.AlertFeedbackSubmitted,
"USER_LOGOUT" => AuditAction.UserLogout,
"TOKEN_REFRESHED" => AuditAction.TokenRefreshed,
"SIMULATION_RUN_STARTED" => AuditAction.SimulationRunStarted,
"SIMULATION_RUN_STOPPED" => AuditAction.SimulationRunStopped,
"SIMULATION_DATA_PURGED" => AuditAction.SimulationDataPurged,
_ => throw new ArgumentOutOfRangeException(nameof(v))
};
}