Files
space-game/apps/backend/Ships/Api/RemoveShipOrderHandler.cs
Jonathan Bourdon 766fef1c8f chore: add .editorconfig and consistent formatting for backend projects
Adds an `.editorconfig` file with C# and project-specific conventions. Applies consistent indentation and formatting across backend handlers, runtime models, and AI services.
2026-03-24 02:55:15 -04:00

31 lines
865 B
C#

using FastEndpoints;
namespace SpaceGame.Api.Ships.Api;
public sealed class RemoveShipOrderRequest
{
public string ShipId { get; set; } = string.Empty;
public string OrderId { get; set; } = string.Empty;
}
public sealed class RemoveShipOrderHandler(WorldService worldService) : Endpoint<RemoveShipOrderRequest, ShipSnapshot>
{
public override void Configure()
{
Delete("/api/ships/{shipId}/orders/{orderId}");
AllowAnonymous();
}
public override async Task HandleAsync(RemoveShipOrderRequest request, CancellationToken cancellationToken)
{
var snapshot = worldService.RemoveShipOrder(request.ShipId, request.OrderId);
if (snapshot is null)
{
await SendNotFoundAsync(cancellationToken);
return;
}
await SendOkAsync(snapshot, cancellationToken);
}
}