feature: In-App Simulation Runner (Backend)
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
public enum SimulationRunStatus { Pending, Running, Completed, Cancelled, Failed }
|
||||
|
||||
public static class SimulationRunStatusExtensions
|
||||
{
|
||||
public static string ToDbString(this SimulationRunStatus s) => s switch
|
||||
{
|
||||
SimulationRunStatus.Pending => "PENDING",
|
||||
SimulationRunStatus.Running => "RUNNING",
|
||||
SimulationRunStatus.Completed => "COMPLETED",
|
||||
SimulationRunStatus.Cancelled => "CANCELLED",
|
||||
SimulationRunStatus.Failed => "FAILED",
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(s))
|
||||
};
|
||||
|
||||
public static SimulationRunStatus FromDbString(string v) => v switch
|
||||
{
|
||||
"PENDING" => SimulationRunStatus.Pending,
|
||||
"RUNNING" => SimulationRunStatus.Running,
|
||||
"COMPLETED" => SimulationRunStatus.Completed,
|
||||
"CANCELLED" => SimulationRunStatus.Cancelled,
|
||||
"FAILED" => SimulationRunStatus.Failed,
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(v), $"Unknown simulation run status: '{v}'")
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user