V13-FE-011: finalize search list layout slice

This commit is contained in:
2026-08-09 02:57:26 +09:00
parent 9efd202e76
commit 6422cb2b13
984 changed files with 120811 additions and 1498 deletions
@@ -0,0 +1,16 @@
namespace KBX.Shared.Workflow;
public sealed record WorkflowTransition(string Id, IReadOnlySet<string> From, string To, string? Permission = null, bool ReasonRequired = false);
public static class WorkflowGuard
{
public static WorkflowTransition RequireTransition(IEnumerable<WorkflowTransition> transitions, string transitionId, string currentState, string? reason = null)
{
var transition = transitions.FirstOrDefault(x => string.Equals(x.Id, transitionId, StringComparison.OrdinalIgnoreCase))
?? throw new InvalidOperationException($"Unknown transition: {transitionId}");
if (!transition.From.Contains(currentState)) throw new InvalidOperationException($"Transition {transitionId} is not allowed from {currentState}.");
if (transition.ReasonRequired && string.IsNullOrWhiteSpace(reason)) throw new InvalidOperationException("A reason is required for this transition.");
return transition;
}
}