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:
@@ -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.",
|
||||
}}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user