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:
@@ -1,12 +1,37 @@
|
||||
package cabana
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"git.golem15.com/golem15/summercms/modules/pact"
|
||||
"git.golem15.com/golem15/summercms/modules/party"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// CompiledListSchema compiles the admin controllers of plugins without a
|
||||
// database or config, as Activate does, and returns the list schema of the
|
||||
// controller id (with its reorder object).
|
||||
func CompiledListSchema(plugins []party.Plugin, id string) (*ListSchema, error) {
|
||||
items, err := collectControllers(plugins)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
types, err := compileFieldTypes(plugins)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
reg, err := compileRegistryWithTypes(items, types)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cc, ok := reg.Get(id)
|
||||
if !ok || cc.List == nil {
|
||||
return nil, fmt.Errorf("cabana: no list schema for %s", id)
|
||||
}
|
||||
return cc.List, nil
|
||||
}
|
||||
|
||||
// AdminAPIRoutes exposes the admin API route inventory (method plus
|
||||
// prefix-relative path) to the external conformance test.
|
||||
func AdminAPIRoutes() []string {
|
||||
|
||||
Reference in New Issue
Block a user