mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-10-27 10:21:08 -04:00
A release can now cover several sets, each with its own kit count, so parts
from different kits share sheets. It can also merge into an existing draft
nest instead of always creating one. Schema v9 replaces the single-set
release tables: releases, their set lines, their nests (created or merged,
with the nest revision before and after) and the drawing quantities each set
added to each nest, so a kit stays traceable once kits share a nest. The v8
migration turns each existing release into one set line with created nests.
Undo runs on the server in one transaction: created nests are soft-deleted
and merged nests restored to their pre-merge revision, but only while each
still holds what the release wrote. Otherwise nothing changes and the
changed nests are listed, so the operator can skip them. A nest restored to
that revision counts as unchanged, which lets releases sharing a nest be
undone newest first.
The old /api/sets/{id}/releases and /api/nests/{id}/release routes are
replaced by /api/releases; no tagged desktop used them. The desktop still
releases one set at a time until the release dialog is reworked.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
51 lines
2.1 KiB
C#
51 lines
2.1 KiB
C#
namespace OpenNest.Data;
|
|
|
|
/// <summary>
|
|
/// One release of one or more drawing sets: the nests it made or merged into, one per
|
|
/// material group, with every member quantity multiplied by its set line's quantity.
|
|
/// Releases are append-only; undoing one restores or deletes its nests and marks it
|
|
/// undone, it never removes the record.
|
|
/// </summary>
|
|
public sealed class SetReleaseRecord
|
|
{
|
|
/// <summary>Allocated by the client, so an ambiguous post can be retried without a duplicate.</summary>
|
|
public Guid Id { get; set; }
|
|
|
|
/// <summary>The sets released and how many times each, in the order posted.</summary>
|
|
public IReadOnlyList<SetReleaseLine> Sets { get; set; } = Array.Empty<SetReleaseLine>();
|
|
|
|
public string Notes { get; set; } = "";
|
|
|
|
/// <summary>When the server stored the release. Server-computed.</summary>
|
|
public DateTime ReleasedAt { get; set; }
|
|
|
|
/// <summary>Who released the sets, as reported by the client.</summary>
|
|
public string ReleasedBy { get; set; } = "";
|
|
|
|
/// <summary>When the release was undone; null while it stands. Server-computed.</summary>
|
|
public DateTime? UndoneAt { get; set; }
|
|
|
|
/// <summary>Who undid the release, as reported by the client. Server-computed.</summary>
|
|
public string UndoneBy { get; set; } = "";
|
|
|
|
/// <summary>The nests the release created or merged into, in the order posted.</summary>
|
|
public IReadOnlyList<SetReleaseNest> Nests { get; set; } = Array.Empty<SetReleaseNest>();
|
|
|
|
public bool IsUndone => UndoneAt.HasValue;
|
|
}
|
|
|
|
/// <summary>One set of a release: the exact revision released and how many kits of it.</summary>
|
|
public sealed class SetReleaseLine
|
|
{
|
|
public Guid SetId { get; set; }
|
|
|
|
/// <summary>The exact set revision released; it need not be the current one.</summary>
|
|
public int SetRevision { get; set; }
|
|
|
|
/// <summary>How many kits: every member quantity is multiplied by this.</summary>
|
|
public int Quantity { get; set; } = 1;
|
|
|
|
/// <summary>The set's name at <see cref="SetRevision"/>. Server-joined; ignored on post.</summary>
|
|
public string SetName { get; set; } = "";
|
|
}
|