Extend PATCH /category/:id to also move (parentId) alongside rename.
PATCH now accepts name (rename, re-slugify) and/or parentId (move under a new parent, cycle/self guarded), merging both results. Renames the PATCH docs file to category/update.md and regenerates API docs.
This commit is contained in:
@@ -1140,14 +1140,14 @@
|
||||
"tags": [
|
||||
"Category"
|
||||
],
|
||||
"summary": "Rename category",
|
||||
"description": "Renames a category the user is authorized for (updates name and re-slugifies in the company default language).",
|
||||
"summary": "Update category (rename or move)",
|
||||
"description": "Updates a category the user is authorized for.\n`name` renames the category (re-slugifies in the company default language).\n`parentId` moves it under a new parent (cycle/self → `Invalid parent`).\nEither `name` or `parentId` (or both) is required.\n",
|
||||
"security": [
|
||||
{
|
||||
"cookieAuth": []
|
||||
}
|
||||
],
|
||||
"x-markdown": "category/rename.md",
|
||||
"x-markdown": "category/update.md",
|
||||
"parameters": [
|
||||
{
|
||||
"in": "path",
|
||||
@@ -1165,16 +1165,17 @@
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"parentId": {
|
||||
"type": "integer",
|
||||
"description": "New parent category id"
|
||||
}
|
||||
},
|
||||
"example": {
|
||||
"name": "Renamed category"
|
||||
"parentId": 3
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1182,7 +1183,7 @@
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Renamed category",
|
||||
"description": "Updated category (renamed and/or moved)",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
@@ -1193,7 +1194,9 @@
|
||||
"required": [
|
||||
"id",
|
||||
"name",
|
||||
"slug"
|
||||
"slug",
|
||||
"parentId",
|
||||
"sort"
|
||||
],
|
||||
"properties": {
|
||||
"id": {
|
||||
@@ -1204,6 +1207,12 @@
|
||||
},
|
||||
"slug": {
|
||||
"type": "string"
|
||||
},
|
||||
"parentId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"sort": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1213,7 +1222,7 @@
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Validation error (name required)",
|
||||
"description": "Validation error (name or parentId required, or invalid parent)",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
|
||||
Reference in New Issue
Block a user