29 lines
1023 B
C#
29 lines
1023 B
C#
namespace NeonSprawl.Server.Game.Gathering;
|
|
|
|
/// <summary>Dev-only route to reset prototype resource-node gathers for Bruno and manual QA.</summary>
|
|
public static class ResourceNodeFixtureApi
|
|
{
|
|
public static WebApplication MapResourceNodeFixtureApi(this WebApplication app)
|
|
{
|
|
app.MapPost(
|
|
"/game/__dev/resource-node-fixture",
|
|
(ResourceNodeFixtureRequest? body, IResourceNodeDefinitionRegistry nodeRegistry,
|
|
IResourceNodeInstanceStore instanceStore) =>
|
|
{
|
|
if (body is null || body.SchemaVersion != ResourceNodeFixtureRequest.CurrentSchemaVersion)
|
|
{
|
|
return Results.BadRequest();
|
|
}
|
|
|
|
if (!ResourceNodeFixtureOperations.TryApply(nodeRegistry, instanceStore))
|
|
{
|
|
return Results.NotFound();
|
|
}
|
|
|
|
return Results.Json(new ResourceNodeFixtureResponse { Applied = true });
|
|
});
|
|
|
|
return app;
|
|
}
|
|
}
|