feat(32.2-01): per-item rows and item actions on My account contributions

- pact: AccountContribution.Items/ItemActions/ItemsEmpty, AccountItem,
  AccountItemAction, AccountItemActionInput, ErrAccountItemNotFound
- cabana: the list sends items (null without Items), permitted item actions
  and the empty line; boot refuses item actions without Items
- cabana: POST {api}/account/contribution-items/{name}/{item}/actions/{action}
  runs only for an item the administrator's own Items listed, in a transaction
  (path outside /account/contributions/ to avoid a ServeMux overlap)
- swag views; admin.json and schema.d.ts regenerated; route inventories
This commit is contained in:
Jakub Zych
2026-11-21 00:22:13 +01:00
parent 97d7ee0586
commit 3f7ce6020d
16 changed files with 706 additions and 30 deletions

View File

@@ -836,6 +836,9 @@ func conformCases() []conformCase {
{"POST /account/contributions/{name}/actions/{action}", 200, "cabana.Envelope-cabana_AccountActionResultView", func(t *testing.T, e *conformEnv) *httptest.ResponseRecorder {
return e.send(t, http.MethodPost, "/account/contributions/conform_link/actions/open", nil, true)
}, into[cabana.Envelope[cabana.AccountActionResultView]](), nil},
{"POST /account/contribution-items/{name}/{item}/actions/{action}", 200, "cabana.Envelope-cabana_AccountActionResultView", func(t *testing.T, e *conformEnv) *httptest.ResponseRecorder {
return e.send(t, http.MethodPost, "/account/contribution-items/conform_link/conform-item/actions/forget", nil, true)
}, into[cabana.Envelope[cabana.AccountActionResultView]](), nil},
{"GET /mcp/consent/{request}", 200, "cabana.Envelope-cabana_MCPConsentView", func(t *testing.T, e *conformEnv) *httptest.ResponseRecorder {
return e.send(t, http.MethodGet, "/mcp/consent/conform-request", nil, true)
}, into[cabana.Envelope[cabana.MCPConsentView]](), nil},
@@ -1298,6 +1301,16 @@ func (conformPlugin) AccountContributions() []pact.AccountContribution {
return pact.AccountActionResult{Message: "Opened", URL: "https://conform.example.test/link"}, nil
},
}},
Items: func(context.Context, uint) ([]pact.AccountItem, error) {
return []pact.AccountItem{{ID: "conform-item", Title: "Conform item", Subtitle: "A row", Meta: []string{"2026-11-21"}}}, nil
},
ItemActions: []pact.AccountItemAction{{
Name: "forget", Label: "Forget", Confirm: "Forget :title?", Danger: true,
Run: func(context.Context, pact.AccountItemActionInput) (pact.AccountActionResult, error) {
return pact.AccountActionResult{Message: "Forgotten"}, nil
},
}},
ItemsEmpty: "No rows.",
}}
}