feat(18.1-01): task 3 flat reorder on the server
- config_reorder.yaml without parentColumn on a record with no parent_id column compiles as a flat (WinterCMS Sortable) reorder; maxDepth above 0 on it fails boot, an explicit parentColumn still means a tree - ListReorder.Flat and AdminReorderTree.Flat (flat, omitempty); flat nodes carry parent_id null, a save writes only the sort column, a parent is a 422 on nodes (reorder.flat_parent); 409 and duplicate rules unchanged - swag descriptions, OpenAPI and schema.d.ts regenerated - acme.catalog badges reorder fixture, TestReorderFlatCompile and TestReorderFlatSmoke; docs Flat reorder section and cabana README
This commit is contained in:
@@ -520,6 +520,10 @@
|
||||
},
|
||||
"cabana.AdminReorderTree": {
|
||||
"properties": {
|
||||
"flat": {
|
||||
"description": "Flat is true for a flat reorder (WinterCMS Sortable): every node's\nparent_id is null and a save writes only the sort column. Omitted for\na tree reorder.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"nodes": {
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/cabana.AdminReorderNode"
|
||||
@@ -1945,6 +1949,10 @@
|
||||
},
|
||||
"cabana.ListReorder": {
|
||||
"properties": {
|
||||
"flat": {
|
||||
"description": "Flat is true for a flat reorder (WinterCMS Sortable): the record has\nno parent column, so the records are only put in order, never nested.\nOmitted for a tree reorder.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"partition": {
|
||||
"$ref": "#/components/schemas/cabana.ListReorderPartition"
|
||||
},
|
||||
@@ -4814,7 +4822,7 @@
|
||||
},
|
||||
"/{vendor}/{plugin}/{controller}/reorder": {
|
||||
"get": {
|
||||
"description": "The records of a controller with config_reorder.yaml, scoped by the list scope (ListExtendQuery) and, when the page has a partition, by one partition: `partition` picks it (an id among `partition.options`; another id answers 404) and defaults to the first option. Nodes carry the id, parent_id (null at the top), sort_order and the nameFrom column as name, ordered by the sort column and then the id. A controller without a reorder page answers 404.",
|
||||
"description": "The records of a controller with config_reorder.yaml, scoped by the list scope (ListExtendQuery) and, when the page has a partition, by one partition: `partition` picks it (an id among `partition.options`; another id answers 404) and defaults to the first option. Nodes carry the id, parent_id (null at the top), sort_order and the nameFrom column as name, ordered by the sort column and then the id. A flat reorder (no parentColumn key and no parent_id column on the record, WinterCMS Sortable) answers `flat: true` and parent_id null on every node; a tree reorder omits `flat`. A controller without a reorder page answers 404.",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Vendor",
|
||||
@@ -4915,7 +4923,7 @@
|
||||
]
|
||||
},
|
||||
"post": {
|
||||
"description": "Saves the parent and sort columns of every record of the scoped set in one transaction that locks the set (ListExtendQuery plus the partition). `nodes` must list exactly the records of that set: any difference (a record added, removed or moved to another partition meanwhile) answers 409 `reorder_stale` and writes nothing. A duplicate id, a parent outside the set, a cycle and a depth above maxDepth answer 422 `validation_failed` on `nodes`; a missing partition on a partitioned page is a 422 on `partition`. The answer is the new tree.",
|
||||
"description": "Saves the parent and sort columns of every record of the scoped set in one transaction that locks the set (ListExtendQuery plus the partition). `nodes` must list exactly the records of that set: any difference (a record added, removed or moved to another partition meanwhile) answers 409 `reorder_stale` and writes nothing. A duplicate id, a parent outside the set, a cycle and a depth above maxDepth answer 422 `validation_failed` on `nodes`; a missing partition on a partitioned page is a 422 on `partition`. On a flat reorder only the sort column is written, and a node with a non-null parent_id is a 422 on `nodes` (`backend::lang.reorder.flat_parent`). The answer is the new tree.",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Vendor",
|
||||
|
||||
16
admin/src/api/schema.d.ts
vendored
16
admin/src/api/schema.d.ts
vendored
@@ -1902,7 +1902,7 @@ export interface paths {
|
||||
};
|
||||
/**
|
||||
* Load a reorder tree
|
||||
* @description The records of a controller with config_reorder.yaml, scoped by the list scope (ListExtendQuery) and, when the page has a partition, by one partition: `partition` picks it (an id among `partition.options`; another id answers 404) and defaults to the first option. Nodes carry the id, parent_id (null at the top), sort_order and the nameFrom column as name, ordered by the sort column and then the id. A controller without a reorder page answers 404.
|
||||
* @description The records of a controller with config_reorder.yaml, scoped by the list scope (ListExtendQuery) and, when the page has a partition, by one partition: `partition` picks it (an id among `partition.options`; another id answers 404) and defaults to the first option. Nodes carry the id, parent_id (null at the top), sort_order and the nameFrom column as name, ordered by the sort column and then the id. A flat reorder (no parentColumn key and no parent_id column on the record, WinterCMS Sortable) answers `flat: true` and parent_id null on every node; a tree reorder omits `flat`. A controller without a reorder page answers 404.
|
||||
*/
|
||||
get: {
|
||||
parameters: {
|
||||
@@ -1973,7 +1973,7 @@ export interface paths {
|
||||
put?: never;
|
||||
/**
|
||||
* Save a reorder tree
|
||||
* @description Saves the parent and sort columns of every record of the scoped set in one transaction that locks the set (ListExtendQuery plus the partition). `nodes` must list exactly the records of that set: any difference (a record added, removed or moved to another partition meanwhile) answers 409 `reorder_stale` and writes nothing. A duplicate id, a parent outside the set, a cycle and a depth above maxDepth answer 422 `validation_failed` on `nodes`; a missing partition on a partitioned page is a 422 on `partition`. The answer is the new tree.
|
||||
* @description Saves the parent and sort columns of every record of the scoped set in one transaction that locks the set (ListExtendQuery plus the partition). `nodes` must list exactly the records of that set: any difference (a record added, removed or moved to another partition meanwhile) answers 409 `reorder_stale` and writes nothing. A duplicate id, a parent outside the set, a cycle and a depth above maxDepth answer 422 `validation_failed` on `nodes`; a missing partition on a partitioned page is a 422 on `partition`. On a flat reorder only the sort column is written, and a node with a non-null parent_id is a 422 on `nodes` (`backend::lang.reorder.flat_parent`). The answer is the new tree.
|
||||
*/
|
||||
post: {
|
||||
parameters: {
|
||||
@@ -5391,6 +5391,12 @@ export interface components {
|
||||
partition: number;
|
||||
};
|
||||
"cabana.AdminReorderTree": {
|
||||
/**
|
||||
* @description Flat is true for a flat reorder (WinterCMS Sortable): every node's
|
||||
* parent_id is null and a save writes only the sort column. Omitted for
|
||||
* a tree reorder.
|
||||
*/
|
||||
flat?: boolean;
|
||||
nodes: components["schemas"]["cabana.AdminReorderNode"][];
|
||||
partition: components["schemas"]["cabana.AdminReorderPartition"];
|
||||
title: string;
|
||||
@@ -5889,6 +5895,12 @@ export interface components {
|
||||
total: number;
|
||||
};
|
||||
"cabana.ListReorder": {
|
||||
/**
|
||||
* @description Flat is true for a flat reorder (WinterCMS Sortable): the record has
|
||||
* no parent column, so the records are only put in order, never nested.
|
||||
* Omitted for a tree reorder.
|
||||
*/
|
||||
flat?: boolean;
|
||||
partition?: components["schemas"]["cabana.ListReorderPartition"];
|
||||
title: string;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user