mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-10-27 10:21:08 -04:00
Schema v5 stores each distinct drawing package once in drawing_packages, keyed by SHA-256; revisions point at it, so details, settings, archive and restore revisions add no blob. The v4 drawing tables are replaced outright (no production library existed); nest tables are untouched. Nesting settings (cut first, priority, rotation constraints, color) become structured record fields (DrawingLibraryRecord.Settings), returned on every read, filterable by cutFirst, editable through the metadata endpoint and applied by LibraryDrawingInsert. Canonical packages now leave every record-owned field at its default, so renaming or changing settings never changes the package hash. Saving a nest drawing to the library carries its settings into the record. The desktop library browser gains a Cut first column and an Edit Settings dialog that saves notes and settings as a new revision with the same package. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
57 lines
2.0 KiB
C#
57 lines
2.0 KiB
C#
using OpenNest;
|
|
|
|
namespace OpenNest.Data;
|
|
|
|
/// <summary>
|
|
/// Server-side metadata for one revision of a shared library drawing. The geometry
|
|
/// travels separately as a drawing package (a single-drawing, zero-plate .nest archive).
|
|
/// </summary>
|
|
public sealed class DrawingLibraryRecord
|
|
{
|
|
/// <summary>Allocated by the client before the first upload; kept by every revision.</summary>
|
|
public Guid Id { get; set; }
|
|
|
|
/// <summary>Immutable revision number, starting at 1. Ignored on upload.</summary>
|
|
public int Revision { get; set; }
|
|
|
|
public string Name { get; set; } = "";
|
|
|
|
public string Customer { get; set; } = "";
|
|
|
|
/// <summary>Post material name, for example "Carbon Steel".</summary>
|
|
public string MaterialName { get; set; } = "";
|
|
|
|
/// <summary>Alloy or grade within the material, for example "A36 HR".</summary>
|
|
public string MaterialGrade { get; set; } = "";
|
|
|
|
/// <summary>Thickness in <see cref="Units"/>, stored rounded to four decimals.</summary>
|
|
public double Thickness { get; set; }
|
|
|
|
public Units Units { get; set; } = Units.Inches;
|
|
|
|
public CutType CutType { get; set; } = CutType.Laser;
|
|
|
|
public string Notes { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// Nesting settings applied when the drawing is added to a nest. Not part of the
|
|
/// package, so changing them adds a revision that reuses the same package.
|
|
/// </summary>
|
|
public DrawingNestingSettings Settings { get; set; } = new();
|
|
|
|
/// <summary>Hidden from browsing by default; still readable by id.</summary>
|
|
public bool Archived { get; set; }
|
|
|
|
/// <summary>Lower-case hex SHA-256 of the package bytes. Server-computed.</summary>
|
|
public string PackageSha256 { get; set; } = "";
|
|
|
|
/// <summary>Package size in bytes. Server-computed.</summary>
|
|
public long PackageSize { 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; } = "";
|
|
}
|