mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-10-27 03:51:05 -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>
31 lines
1.6 KiB
C#
31 lines
1.6 KiB
C#
namespace OpenNest.Data;
|
|
|
|
/// <summary>
|
|
/// The drawing library reads and writes that saving a nest drawing to the library uses.
|
|
/// <see cref="RemoteDrawingLibrary"/> is the only production implementation.
|
|
/// </summary>
|
|
public interface IDrawingLibraryStore : IDrawingLibrary
|
|
{
|
|
/// <summary>The current record, including an archived one, or null for an unknown id.</summary>
|
|
Task<DrawingLibraryRecord?> GetAsync(Guid id, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>One page of immutable revisions, newest first, or null for an unknown id.</summary>
|
|
Task<DrawingLibraryPage?> GetRevisionsAsync(Guid id, int offset = 0,
|
|
int limit = DrawingLibraryRules.DefaultRevisionLimit, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>Stores revision 1 under the caller-allocated <c>record.Id</c>.</summary>
|
|
Task<DrawingLibraryRecord> UploadAsync(DrawingLibraryRecord record, byte[] package,
|
|
CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>Saves the next revision when <paramref name="expectedRevision"/> is current.</summary>
|
|
Task<DrawingLibraryRecord> UpdatePackageAsync(Guid id, DrawingLibraryRecord record, byte[] package,
|
|
int expectedRevision, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Saves new details and nesting settings, keeping the package, as the next revision
|
|
/// when <paramref name="expectedRevision"/> is current.
|
|
/// </summary>
|
|
Task<DrawingLibraryRecord> UpdateMetadataAsync(Guid id, DrawingLibraryRecord record, int expectedRevision,
|
|
CancellationToken cancellationToken = default);
|
|
}
|