From 896bf7672bf25d9fe7ccd98064c45a9509ff251c Mon Sep 17 00:00:00 2001 From: matst80 Date: Thu, 20 Nov 2025 22:41:00 +0100 Subject: [PATCH] more updates --- cmd/cart/openapi.json | 15 ++++++++++----- pkg/cart/mutation_test.go | 21 +++++++++------------ 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/cmd/cart/openapi.json b/cmd/cart/openapi.json index d2c52d8..06d559f 100644 --- a/cmd/cart/openapi.json +++ b/cmd/cart/openapi.json @@ -899,6 +899,15 @@ "outlet": { "type": "string", "nullable": true } } }, + "ConfirmationStatus": { + "type": "object", + "properties": { + "code": { "type": "string", "nullable": true }, + "viewCount": { "type": "integer" }, + "lastViewedAt": { "type": "string", "format": "date-time" } + }, + "required": ["viewCount", "lastViewedAt"] + }, "CartGrain": { "type": "object", "description": "Cart aggregate (actor state)", @@ -933,11 +942,7 @@ } }, "userId": { "type": "string" }, - "confirmationViewCount": { "type": "integer" }, - "confirmationLastViewedAt": { - "type": "string", - "format": "date-time" - }, + "confirmation": { "$ref": "#/components/schemas/ConfirmationStatus" }, "checkoutOrderId": { "type": "string" }, "checkoutStatus": { "type": "string" }, "checkoutCountry": { "type": "string" }, diff --git a/pkg/cart/mutation_test.go b/pkg/cart/mutation_test.go index 39d398b..2a93df0 100644 --- a/pkg/cart/mutation_test.go +++ b/pkg/cart/mutation_test.go @@ -674,29 +674,26 @@ func TestConfirmationViewed(t *testing.T) { g := newTestGrain() // Initial state - if g.ConfirmationViewCount != 0 { - t.Fatalf("initial view count should be 0, got %d", g.ConfirmationViewCount) - } - if !g.ConfirmationLastViewedAt.IsZero() { - t.Fatalf("initial last viewed should be zero") + if g.Confirmation != nil { + t.Fatalf("confirmation should be nil, got %d", g.Confirmation) } // First view applyOK(t, reg, g, msgConfirmationViewed()) - if g.ConfirmationViewCount != 1 { - t.Fatalf("view count should be 1, got %d", g.ConfirmationViewCount) + if g.Confirmation.ViewCount != 1 { + t.Fatalf("view count should be 1, got %d", g.Confirmation.ViewCount) } - if g.ConfirmationLastViewedAt.IsZero() { + if g.Confirmation.LastViewedAt.IsZero() { t.Fatalf("ConfirmationLastViewedAt not set") } - firstTime := g.ConfirmationLastViewedAt + firstTime := g.Confirmation.LastViewedAt // Second view applyOK(t, reg, g, msgConfirmationViewed()) - if g.ConfirmationViewCount != 2 { - t.Fatalf("view count should be 2, got %d", g.ConfirmationViewCount) + if g.Confirmation.ViewCount != 2 { + t.Fatalf("view count should be 2, got %d", g.Confirmation.ViewCount) } - if g.ConfirmationLastViewedAt == firstTime { + if g.Confirmation.LastViewedAt == firstTime { t.Fatalf("ConfirmationLastViewedAt should have updated") } }