mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-10-27 13:51:06 -04:00
A release can now cover several sets, each with its own kit count, so parts
from different kits share sheets. It can also merge into an existing draft
nest instead of always creating one. Schema v9 replaces the single-set
release tables: releases, their set lines, their nests (created or merged,
with the nest revision before and after) and the drawing quantities each set
added to each nest, so a kit stays traceable once kits share a nest. The v8
migration turns each existing release into one set line with created nests.
Undo runs on the server in one transaction: created nests are soft-deleted
and merged nests restored to their pre-merge revision, but only while each
still holds what the release wrote. Otherwise nothing changes and the
changed nests are listed, so the operator can skip them. A nest restored to
that revision counts as unchanged, which lets releases sharing a nest be
undone newest first.
The old /api/sets/{id}/releases and /api/nests/{id}/release routes are
replaced by /api/releases; no tagged desktop used them. The desktop still
releases one set at a time until the release dialog is reworked.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
35 lines
1.2 KiB
C#
35 lines
1.2 KiB
C#
namespace OpenNest.Data;
|
|
|
|
/// <summary>An undo request: who is undoing the release, and which changed nests to leave as they are.</summary>
|
|
public sealed class SetReleaseUndoRequest
|
|
{
|
|
public string UndoneBy { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// Nests of the release to leave alone. Every other nest must still be at the revision
|
|
/// the release wrote, or nothing is undone.
|
|
/// </summary>
|
|
public IReadOnlyList<Guid> SkipNests { get; set; } = Array.Empty<Guid>();
|
|
}
|
|
|
|
public enum SetReleaseUndoRefusal
|
|
{
|
|
/// <summary>The release was undone before.</summary>
|
|
AlreadyUndone,
|
|
|
|
/// <summary>Nests not skipped have changed since the release; <see cref="SetReleaseUndoConflict.ChangedNests"/> lists them.</summary>
|
|
NestsChanged,
|
|
}
|
|
|
|
/// <summary>Why an undo was refused. Nothing was changed.</summary>
|
|
public sealed class SetReleaseUndoConflict
|
|
{
|
|
public SetReleaseUndoRefusal Reason { get; set; }
|
|
|
|
/// <summary>The release as it is now.</summary>
|
|
public SetReleaseRecord Release { get; set; } = new();
|
|
|
|
/// <summary>The current metadata of each nest that moved on since the release, deleted or not.</summary>
|
|
public IReadOnlyList<NestRecord> ChangedNests { get; set; } = Array.Empty<NestRecord>();
|
|
}
|