mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-10-27 18:31:08 -04:00
Operators want to release a few loose drawings without first building a set for them. The release record gains a `drawings` list (drawingId, quantity, joined drawingName) and nest items with no `setId` carry those drawings' quantities, so grouping, merging and undo stay one path. Schema v11 adds release_drawings and rebuilds release_nest_items with a nullable setId (SQLite cannot drop NOT NULL), keeping every row. The query gains `drawingId=`; a server from before this refuses that unknown parameter with 400, which the client turns into ServerTooOldException. SetReleaseSession asks before building anything, because the release is posted only after its nests are saved and an old server would refuse it then. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
69 lines
2.8 KiB
C#
69 lines
2.8 KiB
C#
namespace OpenNest.Data;
|
|
|
|
/// <summary>
|
|
/// One release of drawing sets, library drawings on their own, or both: 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>();
|
|
|
|
/// <summary>
|
|
/// Library drawings released on their own, outside any set, in the order posted. Empty for
|
|
/// a release of sets only and for every release recorded before schema v11.
|
|
/// </summary>
|
|
public IReadOnlyList<SetReleaseDrawing> Drawings { get; set; } = Array.Empty<SetReleaseDrawing>();
|
|
|
|
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; } = "";
|
|
}
|
|
|
|
/// <summary>One library drawing released on its own, outside any set, and how many of it.</summary>
|
|
public sealed class SetReleaseDrawing
|
|
{
|
|
public Guid DrawingId { get; set; }
|
|
|
|
public int Quantity { get; set; } = 1;
|
|
|
|
/// <summary>The drawing's current library name. Server-joined; ignored on post.</summary>
|
|
public string DrawingName { get; set; } = "";
|
|
}
|