more updates
All checks were successful
Build and Publish / BuildAndDeployAmd64 (push) Successful in 43s
Build and Publish / BuildAndDeployArm64 (push) Successful in 4m20s

This commit is contained in:
matst80
2025-11-20 22:41:00 +01:00
parent c859796b1e
commit 896bf7672b
2 changed files with 19 additions and 17 deletions

View File

@@ -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" },

View File

@@ -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")
}
}