feat(server): report a nest's sheet sizes and part counts

GET /api/nests/{id}/sheets reads the stored archive's nest.json and returns
the sheet sizes it needs (grouped, width the shorter side, quantities summed)
and each drawing's required and nested counts, skipping the trailing empty
plate as plateCount does. MaterialLedger builds material holds from it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ajandClaude Opus 5.5 committed 2026-10-23 06:01:43 -04:00
1 parent 07e7d7edcd
commit 39f28c7fa9
5 files changed
+305 -15

No files matched your search

+10
View File
@@ -49,6 +49,16 @@ app.MapGet("/api/nests/{id:guid}", (Guid id, NestDatabase db) =>
app.MapGet("/api/nests/{id:guid}/file", (Guid id, NestDatabase db) =>
db.GetFile(id) is { } file ? Results.File(file, "application/zip", $"{id}.nest") : Results.NotFound());
// Sheet sizes and part counts the stored archive needs (inventory holds read this).
app.MapGet("/api/nests/{id:guid}/sheets", (Guid id, NestDatabase db) =>
{
if (db.Get(id) is not { } record || db.GetFile(id) is not { } file)
return Results.NotFound();
return NestArchive.ReadSheets(record, file, out var sheets) is { } archiveError
? Results.Problem(archiveError)
: Results.Ok(sheets);
});
// Next generated nest name for a year; one counter per year shared by every client.
app.MapPost("/api/nest-names/next", (int year, NestDatabase db) =>
{