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:
parent
827fe6b41f
commit
adc27a006b
7 changed files with 177 additions and 7 deletions
|
|
@ -1,6 +1,8 @@
|
|||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Net.Http.Json;
|
||||
using System.Text.Json;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Yavsc.Api.Test.Fixtures;
|
||||
using Yavsc.Helpers;
|
||||
|
|
@ -244,4 +246,36 @@ public sealed class FrontOfficeApiControllerTests : IClassFixture<ApiWebServerFi
|
|||
|
||||
Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Estimate_payload_carries_existing_signature_strokes()
|
||||
{
|
||||
var (queryId, estimateId) = SeedQuery(withEstimate: true);
|
||||
|
||||
// Provider accepts with a signature.
|
||||
using (var pro = NewClient(subject: "alice"))
|
||||
{
|
||||
var r = await pro.PostAsync(
|
||||
$"/api/v1/front/query/accept?billingCode=Rdv&queryId={queryId}",
|
||||
WithSignature(),
|
||||
TestContext.Current.CancellationToken);
|
||||
Assert.True(r.IsSuccessStatusCode, await r.Content.ReadAsStringAsync(TestContext.Current.CancellationToken));
|
||||
}
|
||||
|
||||
// The estimate read endpoint carries the signature strokes on
|
||||
// the estimate payload, so PostIt can repaint them on reopen.
|
||||
using var reader = NewClient(subject: "alice");
|
||||
var response = await reader.GetAsync(
|
||||
$"/api/v1/estimate/{estimateId}",
|
||||
TestContext.Current.CancellationToken);
|
||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||
|
||||
var body = await response.Content.ReadFromJsonAsync<JsonElement>(TestContext.Current.CancellationToken);
|
||||
var sigs = body.GetProperty("signatures");
|
||||
Assert.Equal(JsonValueKind.Array, sigs.ValueKind);
|
||||
var first = sigs.EnumerateArray().First();
|
||||
// SignatureType.Pro = 0.
|
||||
Assert.Equal(0, first.GetProperty("type").GetInt32());
|
||||
Assert.Equal(JsonValueKind.Array, first.GetProperty("strokes").ValueKind);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue