-
-
Notifications
You must be signed in to change notification settings - Fork 514
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved Categorise endpoint to Wolverine
- Loading branch information
1 parent
62abac3
commit 07ff838
Showing
5 changed files
with
28 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
Sample/Helpdesk.Wolverine/Helpdesk.Api/Incidents/Categorise/CategoriseIncidentEndpoint.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
using Wolverine.Http; | ||
using Wolverine.Marten; | ||
using static Microsoft.AspNetCore.Http.TypedResults; | ||
|
||
namespace Helpdesk.Api.Incidents.Categorise; | ||
|
||
public static class CategoriseIncidentEndpoint | ||
{ | ||
[AggregateHandler] | ||
[WolverinePost("api/agents/{agentId:guid}/incidents/{incidentId:guid}/category")] | ||
public static (IResult, Events) Post( | ||
CategoriseIncidentRequest request, | ||
Incident incident, | ||
[FromRoute] Guid agentId, | ||
[FromRoute] Guid incidentId, | ||
DateTimeOffset now) | ||
{ | ||
if (incident.Status == IncidentStatus.Closed) | ||
{ | ||
throw new InvalidOperationException("Incident is already closed"); | ||
} | ||
|
||
return (Ok(), new Events { new IncidentCategorised(incidentId, request.Category, agentId, now) }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters