ff8dadefee
Made the following changes, many of these are just to align with existing conventions. - Updated urls to be hypenated, instead of underscored, to match other system endpoints. - Updated URL parameter to be `deletionId` instead of `id`, and removed the ID-based comment on controller methods, so the required ID model is clear from the URL alone, since its not clear from the URL endpoint alone like existing endpoints. This follows the pattern used in the "web" routes. - Added extra detail on some controller method comments, and copied permission comment to each method. - Removed existing field visibility mechanisms to use simpler model-based visibility since we didn't need anything too special here (After some of my other changes). - Allowed the "deletable" model to be shown in response to provide a little more detail on the main deleted item. - Updated parent/child-count loading to be on the "deletable" model instead of additional properties which results in simpler controller logic and enforces the idea these are relations on the deletable, not the deletion itself. It also removes additional exposure of model namespacing. - Updated (int) casts to intval, just since that's our most common conversion method in the codebase. - Testing: Removed `actingAsAuthorizedUser` and used the admin user instead to prevent extra auth steps on each test. - Testing: Cut logic/data-checks from tests if already covered by other tests. - Testing: Added simple assertions for delete/restore response data. - Examples: Updated list example to reflect changes. Review of PR #3377 To be followed up with changes to polymorphic relations to hide namespacing.
64 lines
No EOL
1.7 KiB
JSON
64 lines
No EOL
1.7 KiB
JSON
{
|
|
"data": [
|
|
{
|
|
"id": 18,
|
|
"deleted_by": 1,
|
|
"created_at": "2022-04-20T12:57:46.000000Z",
|
|
"updated_at": "2022-04-20T12:57:46.000000Z",
|
|
"deletable_type": "page",
|
|
"deletable_id": 2582,
|
|
"deletable": {
|
|
"id": 2582,
|
|
"book_id": 25,
|
|
"chapter_id": 0,
|
|
"name": "A Wonderful Page",
|
|
"slug": "a-wonderful-page",
|
|
"priority": 9,
|
|
"created_at": "2022-02-08T00:44:45.000000Z",
|
|
"updated_at": "2022-04-20T12:57:46.000000Z",
|
|
"created_by": 1,
|
|
"updated_by": 1,
|
|
"draft": false,
|
|
"revision_count": 1,
|
|
"template": false,
|
|
"owned_by": 1,
|
|
"editor": "wysiwyg",
|
|
"book_slug": "a-great-book",
|
|
"parent": {
|
|
"id": 25,
|
|
"name": "A Great Book",
|
|
"slug": "a-great-book",
|
|
"description": "",
|
|
"created_at": "2022-01-24T16:14:28.000000Z",
|
|
"updated_at": "2022-03-06T15:14:50.000000Z",
|
|
"created_by": 1,
|
|
"updated_by": 1,
|
|
"owned_by": 1,
|
|
"type": "book"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"id": 19,
|
|
"deleted_by": 1,
|
|
"created_at": "2022-04-25T16:07:46.000000Z",
|
|
"updated_at": "2022-04-25T16:07:46.000000Z",
|
|
"deletable_type": "book",
|
|
"deletable_id": 13,
|
|
"deletable": {
|
|
"id": 13,
|
|
"name": "A Big Book!",
|
|
"slug": "a-big-book",
|
|
"description": "This is a very large book with loads of cool stuff in it!",
|
|
"created_at": "2021-11-08T11:26:43.000000Z",
|
|
"updated_at": "2022-04-25T16:07:47.000000Z",
|
|
"created_by": 27,
|
|
"updated_by": 1,
|
|
"owned_by": 1,
|
|
"pages_count": 208,
|
|
"chapters_count": 50
|
|
}
|
|
}
|
|
],
|
|
"total": 2
|
|
} |