Refactor runtime bootstrap and ship control flows
This commit is contained in:
@@ -7,7 +7,6 @@ public sealed class EnqueueShipOrderHandler(WorldService worldService) : Endpoin
|
||||
public override void Configure()
|
||||
{
|
||||
Post("/api/ships/{shipId}/orders");
|
||||
AllowAnonymous();
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(ShipOrderCommandRequest request, CancellationToken cancellationToken)
|
||||
|
||||
35
apps/backend/Ships/Api/GetShipAutomationCatalogHandler.cs
Normal file
35
apps/backend/Ships/Api/GetShipAutomationCatalogHandler.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using FastEndpoints;
|
||||
|
||||
namespace SpaceGame.Api.Ships.Api;
|
||||
|
||||
public sealed class GetShipAutomationCatalogHandler : EndpointWithoutRequest<ShipAutomationCatalogSnapshot>
|
||||
{
|
||||
public override void Configure()
|
||||
{
|
||||
Get("/api/ships/catalog");
|
||||
AllowAnonymous();
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
var snapshot = new ShipAutomationCatalogSnapshot(
|
||||
ShipAutomationCatalog.Behaviors
|
||||
.Select(definition => new ShipBehaviorDefinitionSnapshot(
|
||||
definition.Id,
|
||||
definition.Label,
|
||||
definition.Category,
|
||||
definition.SupportStatus.ToString(),
|
||||
definition.Notes))
|
||||
.ToList(),
|
||||
ShipAutomationCatalog.Orders
|
||||
.Select(definition => new ShipOrderDefinitionSnapshot(
|
||||
definition.Id,
|
||||
definition.Label,
|
||||
definition.Category,
|
||||
definition.SupportStatus.ToString(),
|
||||
definition.Notes))
|
||||
.ToList());
|
||||
|
||||
await SendOkAsync(snapshot, cancellationToken);
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,6 @@ public sealed class RemoveShipOrderHandler(WorldService worldService) : Endpoint
|
||||
public override void Configure()
|
||||
{
|
||||
Delete("/api/ships/{shipId}/orders/{orderId}");
|
||||
AllowAnonymous();
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(RemoveShipOrderRequest request, CancellationToken cancellationToken)
|
||||
|
||||
@@ -7,7 +7,6 @@ public sealed class UpdateShipDefaultBehaviorHandler(WorldService worldService)
|
||||
public override void Configure()
|
||||
{
|
||||
Put("/api/ships/{shipId}/default-behavior");
|
||||
AllowAnonymous();
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(ShipDefaultBehaviorCommandRequest request, CancellationToken cancellationToken)
|
||||
|
||||
Reference in New Issue
Block a user