feat(12.2-03): add parent-scoped child show, update, delete and pivot routes
- loadChild finds a child with one query carrying the parent predicate; a foreign child is 404
- GET/PUT .../records/{child} and POST .../delete (all or nothing) per relation kind
- hasMany link adopts NULL-key rows and unlink clears the key; pending created children are never candidates
- link accepts pivot values for one id through the pivot.form whitelist; GET/PUT .../pivot/{child}
- Link and Unlink share linkRelated/unlinkRelated for the deferred commit
This commit is contained in:
@@ -63,6 +63,11 @@ var phase09Routes = []adminRoute{
|
||||
{key: "POST /{vendor}/{plugin}/{controller}/{id}/relations/{name}/link"},
|
||||
{key: "POST /{vendor}/{plugin}/{controller}/{id}/relations/{name}/unlink"},
|
||||
{key: "POST /{vendor}/{plugin}/{controller}/{id}/relations/{name}/records"},
|
||||
{key: "GET /{vendor}/{plugin}/{controller}/{id}/relations/{name}/records/{child}"},
|
||||
{key: "PUT /{vendor}/{plugin}/{controller}/{id}/relations/{name}/records/{child}"},
|
||||
{key: "POST /{vendor}/{plugin}/{controller}/{id}/relations/{name}/delete"},
|
||||
{key: "GET /{vendor}/{plugin}/{controller}/{id}/relations/{name}/pivot/{child}"},
|
||||
{key: "PUT /{vendor}/{plugin}/{controller}/{id}/relations/{name}/pivot/{child}"},
|
||||
{key: "GET /{vendor}/{plugin}/{controller}/{id}/files/{field}", mounted: nestedGetRoute},
|
||||
{key: "POST /{vendor}/{plugin}/{controller}/{id}/files/{field}"},
|
||||
{key: "POST /{vendor}/{plugin}/{controller}/{id}/files/{field}/reorder"},
|
||||
@@ -295,6 +300,11 @@ func phase09ProtectedCalls() []phase09Call {
|
||||
{"relation-link", (*service).relationLink},
|
||||
{"relation-unlink", (*service).relationUnlink},
|
||||
{"relation-child-create", (*service).relationChildCreate},
|
||||
{"relation-child-show", (*service).relationChildShow},
|
||||
{"relation-child-update", (*service).relationChildUpdate},
|
||||
{"relation-child-delete", (*service).relationChildDelete},
|
||||
{"relation-pivot-show", (*service).relationPivotShow},
|
||||
{"relation-pivot-update", (*service).relationPivotUpdate},
|
||||
{"file-list", (*service).fileList},
|
||||
{"file-upload", (*service).fileUpload},
|
||||
{"file-reorder", (*service).fileReorder},
|
||||
|
||||
Reference in New Issue
Block a user