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:
@@ -51,9 +51,27 @@
|
||||
"type": "string"
|
||||
},
|
||||
"error": {
|
||||
"description": "Error is true when the section's status or one of its actions could\nnot be loaded (the plugin's Status or an action's Applies failed; that\naction is left out); the other sections are answered as usual. Absent\notherwise.",
|
||||
"description": "Error is true when the section's status, its items or one of its\nactions could not be loaded (the plugin's Status, Items or an action's\nApplies failed; that action is left out); the other sections are\nanswered as usual. Absent otherwise.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"item_actions": {
|
||||
"description": "ItemActions are the buttons of each row the admin holds the\npermissions for; null for a section without Items. Confirm may hold\n:title, which the admin fills with the row's title.",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/cabana.AccountContributionActionView"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"items": {
|
||||
"description": "Items are the signed-in admin's rows of a section with an Items\nfunction: an array, possibly empty. null for a section without Items\nand when the section's Items failed.",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/cabana.AccountItemView"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"items_empty": {
|
||||
"description": "ItemsEmpty is the translated line for a section with no rows; \"\" means\nthe admin's own empty line.",
|
||||
"type": "string"
|
||||
},
|
||||
"label": {
|
||||
"type": "string"
|
||||
},
|
||||
@@ -68,12 +86,41 @@
|
||||
"required": [
|
||||
"actions",
|
||||
"description",
|
||||
"item_actions",
|
||||
"items",
|
||||
"items_empty",
|
||||
"label",
|
||||
"name",
|
||||
"status"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"cabana.AccountItemView": {
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"meta": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"subtitle": {
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"meta",
|
||||
"subtitle",
|
||||
"title"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"cabana.AdminAPIToken": {
|
||||
"properties": {
|
||||
"created_at": {
|
||||
@@ -3805,6 +3852,101 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/account/contribution-items/{name}/{item}/actions/{action}": {
|
||||
"post": {
|
||||
"description": "Runs one item action of a contributed section on one of the signed-in admin's rows. The action's permissions are checked (403); an item the section's Items does not list for this admin, or one that is gone, is 404. The answer is the action's message and an optional URL to open. Personal API tokens are refused (403 interactive_only).",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Section name",
|
||||
"in": "path",
|
||||
"name": "name",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "Item id",
|
||||
"in": "path",
|
||||
"name": "item",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "Item action name",
|
||||
"in": "path",
|
||||
"name": "action",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/cabana.Envelope-cabana_AccountActionResultView"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "OK"
|
||||
},
|
||||
"401": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/cabana.ErrorEnvelope"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Unauthorized"
|
||||
},
|
||||
"403": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/cabana.ErrorEnvelope"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Forbidden"
|
||||
},
|
||||
"404": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/cabana.ErrorEnvelope"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Not Found"
|
||||
},
|
||||
"422": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/cabana.ErrorEnvelope"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Unprocessable Entity"
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"BackendBearer": []
|
||||
}
|
||||
],
|
||||
"summary": "Run a My account item action",
|
||||
"tags": [
|
||||
"admin"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/account/contributions": {
|
||||
"get": {
|
||||
"description": "Lists the sections plugins contribute to the signed-in admin's My account page: label, description, the status for this admin and the actions they may run that apply to them. Empty when no plugin contributes. Personal API tokens are refused (403 interactive_only).",
|
||||
|
||||
Reference in New Issue
Block a user