feat(backend): add problem/need submission module with workflow and events
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.
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
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,
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user