mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-11-10 19:01:11 -05:00
feat(library): content-addressed packages and editable nesting settings
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>
This commit is contained in:
1 parent
42d99f296c
commit
5a374aa3f4
32 files changed
+1502
-118
No files matched your search
@@ -137,8 +137,9 @@ public sealed class DrawingLibrarySaveSession
|
||||
/// <summary>
|
||||
/// Library details to start from: the drawing's name, its customer (or the nest's), the
|
||||
/// nest's material and grade (or the drawing's when the nest has none), the nest's
|
||||
/// thickness and units, and the linked revision's cut type and notes when the drawing
|
||||
/// came from this server's library, otherwise <paramref name="lastCutType"/>.
|
||||
/// thickness and units, the linked revision's cut type and notes when the drawing
|
||||
/// came from this server's library, otherwise <paramref name="lastCutType"/>, and the
|
||||
/// drawing's own nesting settings.
|
||||
/// </summary>
|
||||
public DrawingLibraryRecord Prefill(CutType lastCutType, string savedBy)
|
||||
{
|
||||
@@ -154,6 +155,7 @@ public sealed class DrawingLibrarySaveSession
|
||||
Units = Nest.Units,
|
||||
CutType = link?.CutType ?? (Enum.IsDefined(lastCutType) ? lastCutType : CutType.Laser),
|
||||
Notes = link?.Notes ?? "",
|
||||
Settings = DrawingNestingSettings.FromDrawing(Drawing),
|
||||
SavedBy = savedBy ?? "",
|
||||
};
|
||||
}
|
||||
@@ -351,6 +353,7 @@ public sealed class DrawingLibrarySaveSession
|
||||
Units = record.Units,
|
||||
CutType = record.CutType,
|
||||
Notes = record.Notes,
|
||||
Settings = record.Settings,
|
||||
Archived = record.Archived,
|
||||
PackageSha256 = record.PackageSha256,
|
||||
PackageSize = record.PackageSize,
|
||||
@@ -391,7 +394,8 @@ public sealed class DrawingLibrarySaveSession
|
||||
&& record.Name == Metadata.Name && record.Customer == Metadata.Customer
|
||||
&& record.MaterialName == Metadata.MaterialName && record.MaterialGrade == Metadata.MaterialGrade
|
||||
&& record.Thickness == DrawingLibraryRules.NormalizeThickness(Metadata.Thickness)
|
||||
&& record.Units == Metadata.Units && record.CutType == Metadata.CutType && record.Notes == Metadata.Notes;
|
||||
&& record.Units == Metadata.Units && record.CutType == Metadata.CutType && record.Notes == Metadata.Notes
|
||||
&& Equals(record.Settings, Metadata.Settings);
|
||||
|
||||
/// <summary>True when a new request asks for exactly this save again.</summary>
|
||||
public bool Matches(DrawingLibraryRecord metadata, byte[] package, DrawingLibraryRecord? revise) =>
|
||||
@@ -400,6 +404,7 @@ public sealed class DrawingLibrarySaveSession
|
||||
&& metadata.Name == Metadata.Name && metadata.Customer == Metadata.Customer
|
||||
&& metadata.MaterialName == Metadata.MaterialName && metadata.MaterialGrade == Metadata.MaterialGrade
|
||||
&& DrawingLibraryRules.NormalizeThickness(metadata.Thickness) == DrawingLibraryRules.NormalizeThickness(Metadata.Thickness)
|
||||
&& metadata.Units == Metadata.Units && metadata.CutType == Metadata.CutType && metadata.Notes == Metadata.Notes;
|
||||
&& metadata.Units == Metadata.Units && metadata.CutType == Metadata.CutType && metadata.Notes == Metadata.Notes
|
||||
&& Equals(metadata.Settings, Metadata.Settings);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user