Files
OpenNest/OpenNest.Data/DrawingSetRecord.cs
T
ajandClaude Opus 5.5 be057bf337 feat(server): store versioned drawing sets
A drawing set is a named list of library drawings with quantities (a kit,
an assembly, a recurring order) that will later be released into one nest
per material. This is the server half: sets get the same revision,
If-Match and archive contract as /api/drawings so the client and tests
follow a known shape.

Schema v7 adds drawing_sets, drawing_set_revisions and
drawing_set_members. Members reference drawings by id and mean each
drawing's current revision, so reads join the current drawing record:
the client can group members by material without one request per drawing,
and the joined record is ignored on save so a read record can be sent
back unchanged. Every change keeps its own member list, and
/api/drawings/{id}/sets answers "used in" from current revisions only.

The drawing query's enum, integer and history-paging parsing is now shared
so both APIs refuse bad input identically.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 12:51:56 -04:00

40 lines
1.5 KiB
C#

namespace OpenNest.Data;
/// <summary>
/// One revision of a drawing set: a named list of library drawings with per-member
/// quantities (a kit, an assembly, a recurring order). Members reference drawings by id;
/// the set always means each drawing's current revision.
/// </summary>
public sealed class DrawingSetRecord
{
/// <summary>Allocated by the client before the first save; kept by every revision.</summary>
public Guid Id { get; set; }
/// <summary>Immutable revision number, starting at 1. Ignored on save.</summary>
public int Revision { get; set; }
public string Name { get; set; } = "";
public string Customer { get; set; } = "";
public string Notes { get; set; } = "";
/// <summary>Hidden from browsing by default; still readable by id.</summary>
public bool Archived { get; set; }
/// <summary>When the server stored this revision. Server-computed.</summary>
public DateTime SavedAt { get; set; }
/// <summary>Who saved this revision, as reported by the client.</summary>
public string SavedBy { get; set; } = "";
/// <summary>Number of members in this revision. Server-computed.</summary>
public int MemberCount { get; set; }
/// <summary>
/// The members in order, one per drawing. Empty on query and history pages, which
/// carry <see cref="MemberCount"/> only.
/// </summary>
public IReadOnlyList<DrawingSetMember> Members { get; set; } = Array.Empty<DrawingSetMember>();
}