Reopen estimate: carry signature strokes on the estimate payload

Reopening an already-validated estimate showed an empty pad: the
strokes were stored server-side but never sent back. Embed them in the
estimate payload and load them straight into the pad, in the same wire
format PostIt captured — no separate fetch.

- Server: Signature inverse navs get STJ [JsonIgnore] (cycle-safe
  under System.Text.Json, matching ApplicationUser); the four estimate
  read endpoints Include(e => e.Signatures) so strokes ride the payload
- Client: EstimateDto.Signatures with EstimateSignatureDto (Strokes,
  Type=Pro/0|Client/1, CoordinateMax, CapturedAtUtc)
- PostIt: SignaturePadControl.Load(int[]) replaces the buffer and
  raises RedrawRequested; EstimateValidationPageViewModel.LoadExisting
  Signature() picks the perspective's side off the estimate and loads
  it on Attach
- Tests: server asserts GET estimate/{id} carries the strokes; PostIt
  VM tests cover load + side-by-perspective

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
Paul Schneider 2026-09-21 18:03:08 +01:00
commit 064be13388
7 changed files with 177 additions and 7 deletions

View file

@ -39,6 +39,37 @@ public sealed class EstimateDto
public string CommandType { get; set; } = string.Empty;
public DateTime ProviderValidationDate { get; set; }
public DateTime ClientValidationDate { get; set; }
/// <summary>
/// Signatures already captured against this estimate (Pro and/or
/// Client), as returned with the estimate payload. Each carries the
/// PostIt wire-format <see cref="EstimateSignatureDto.Strokes"/>
/// so the pad can repaint a previously drawn signature on reopen
/// without a second round-trip. Null/empty when nobody has signed.
/// </summary>
public List<EstimateSignatureDto>? Signatures { get; set; }
}
/// <summary>
/// One stored signature on an estimate, mirroring the JSON shape of
/// the server-side <c>Yavsc.Models.Billing.Signature</c> entity. The
/// <see cref="Strokes"/> are the same PostIt wire-format payload that
/// was captured and are loaded back into the pad unchanged.
/// </summary>
public sealed class EstimateSignatureDto
{
public long Id { get; set; }
public long EstimateId { get; set; }
/// <summary>
/// Who signed, as the integer value of the server
/// <c>SignatureType</c> enum: <c>0</c> = Pro (provider),
/// <c>1</c> = Client. Matched by value on the client so PostIt
/// need not reference the server enum.
/// </summary>
public int Type { get; set; }
public int CoordinateMax { get; set; }
public DateTime CapturedAtUtc { get; set; }
public int[]? Strokes { get; set; }
}
/// <summary>