Add submission CRUD with pagination and role scoping, challenge/location binding, automatic keyword extraction, a validated status workflow, and domain events for matchmaking and notifications. Create a problem record together with each submission.
37 lines
1.1 KiB
C#
37 lines
1.1 KiB
C#
using TarninaHub.Domain.Enums;
|
|
|
|
namespace TarninaHub.Application.Mappings;
|
|
|
|
public static class SubmissionStatusWire
|
|
{
|
|
public static string ToWire(this SubmissionStatus status) => status switch
|
|
{
|
|
SubmissionStatus.New => "new",
|
|
SubmissionStatus.Triaged => "triaged",
|
|
SubmissionStatus.Matched => "matched",
|
|
SubmissionStatus.InProgress => "in_progress",
|
|
SubmissionStatus.Closed => "closed",
|
|
SubmissionStatus.Rejected => "rejected",
|
|
_ => throw new ArgumentOutOfRangeException(nameof(status), status, null),
|
|
};
|
|
|
|
public static SubmissionStatus? Parse(string? value)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(value))
|
|
{
|
|
return null;
|
|
}
|
|
|
|
return value switch
|
|
{
|
|
"new" => SubmissionStatus.New,
|
|
"triaged" => SubmissionStatus.Triaged,
|
|
"matched" => SubmissionStatus.Matched,
|
|
"in_progress" => SubmissionStatus.InProgress,
|
|
"closed" => SubmissionStatus.Closed,
|
|
"rejected" => SubmissionStatus.Rejected,
|
|
_ => null,
|
|
};
|
|
}
|
|
}
|