mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-10-27 15:01:07 -04:00
The server becomes the system of record for shared drawings (cut type, thickness, material and grade, customer, notes). Schema v4 adds `drawings` (current row) and `drawing_revisions` (immutable) to the same SQLite file under the existing monitor; the nest tables are untouched and a v3 upgrade keeps every nest row byte-identical. `/api/drawings` follows the nest revision contract: client-allocated ids, If-Match on every existing-drawing write (428/400/409 with no state change), archive instead of delete, and one transaction for promotion plus snapshot. Geometry is an opaque package (a zero-plate .nest) the server never parses. Enum fields accept single names only, because the JSON enum converter would otherwise accept numbers and comma combinations. Material, grade and customer filters match SharedListNames keys so spacing and case cannot split a drawing family; thickness is stored and compared at four decimals. Shared bounds live in OpenNest.Data so the client can refuse the same requests before sending. If-Match parsing moves to one helper used by nests and drawings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
51 lines
1.8 KiB
C#
51 lines
1.8 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>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; } = "";
|
|
}
|