1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-28 17:02:04 +03:00

Reviewed and added testing for BookShelf API implementation

- Tweaked how books are passed on update to prevent unassignment if
parameter is not provided.
- Added books to validation so they show in docs.
- Added request/response examples.
- Added tests to cover.
- Added child book info to shelf info.

Review of #1908
This commit is contained in:
Dan Brown
2020-04-10 15:19:18 +01:00
parent da1cea06ca
commit 29705a25ce
13 changed files with 296 additions and 17 deletions

View File

@ -0,0 +1,5 @@
{
"name": "My shelf",
"description": "This is my shelf with some books",
"books": [5,1,3]
}

View File

@ -0,0 +1,5 @@
{
"name": "My updated shelf",
"description": "This is my update shelf with some books",
"books": [5,1,3]
}

View File

@ -8,15 +8,11 @@
"created_by": {
"id": 1,
"name": "Admin",
"created_at": "2019-05-05 21:15:13",
"updated_at": "2019-12-16 12:18:37",
"image_id": 48
},
"updated_by": {
"id": 1,
"name": "Admin",
"created_at": "2019-05-05 21:15:13",
"updated_at": "2019-12-16 12:18:37",
"image_id": 48
},
"image_id": 452,

View File

@ -0,0 +1,10 @@
{
"name": "My shelf",
"description": "This is my shelf with some books",
"created_by": 1,
"updated_by": 1,
"slug": "my-shelf",
"updated_at": "2020-04-10 13:24:09",
"created_at": "2020-04-10 13:24:09",
"id": 14
}

View File

@ -0,0 +1,38 @@
{
"data": [
{
"id": 8,
"name": "Qui qui aspernatur autem molestiae libero necessitatibus molestias.",
"slug": "qui-qui-aspernatur-autem-molestiae-libero-necessitatibus-molestias",
"description": "Enim dolor ut quia error dolores est. Aut distinctio consequuntur non nisi nostrum. Labore cupiditate error labore aliquid provident impedit voluptatibus. Quaerat impedit excepturi eius qui eius voluptatem reiciendis.",
"created_at": "2019-05-05 22:10:16",
"updated_at": "2020-04-10 13:00:45",
"created_by": 4,
"updated_by": 1,
"image_id": 31
},
{
"id": 9,
"name": "Ipsum aut inventore fuga libero non facilis.",
"slug": "ipsum-aut-inventore-fuga-libero-non-facilis",
"description": "Labore culpa modi perspiciatis harum sit. Maxime non et nam est. Quae ut laboriosam repellendus sunt quisquam. Velit at est perspiciatis nesciunt adipisci nobis illo. Sed possimus odit optio officiis nisi voluptates officiis dolor.",
"created_at": "2019-05-05 22:10:16",
"updated_at": "2020-04-10 13:00:58",
"created_by": 4,
"updated_by": 1,
"image_id": 28
},
{
"id": 10,
"name": "Omnis reiciendis aut molestias sint accusantium.",
"slug": "omnis-reiciendis-aut-molestias-sint-accusantium",
"description": "Qui ea occaecati alias est dolores voluptatem doloribus. Ad reiciendis corporis vero nostrum omnis et. Non doloribus ut eaque ut quos dolores.",
"created_at": "2019-05-05 22:10:16",
"updated_at": "2020-04-10 13:00:53",
"created_by": 4,
"updated_by": 1,
"image_id": 30
}
],
"total": 3
}

View File

@ -0,0 +1,60 @@
{
"id": 14,
"name": "My shelf",
"slug": "my-shelf",
"description": "This is my shelf with some books",
"created_by": {
"id": 1,
"name": "Admin",
"image_id": 48
},
"updated_by": {
"id": 1,
"name": "Admin",
"image_id": 48
},
"image_id": 501,
"created_at": "2020-04-10 13:24:09",
"updated_at": "2020-04-10 13:31:04",
"tags": [
{
"id": 16,
"entity_id": 14,
"entity_type": "BookStack\\Bookshelf",
"name": "Category",
"value": "Guide",
"order": 0,
"created_at": "2020-04-10 13:31:04",
"updated_at": "2020-04-10 13:31:04"
}
],
"cover": {
"id": 501,
"name": "anafrancisconi_Sp04AfFCPNM.jpg",
"url": "http://bookstack.local/uploads/images/cover_book/2020-04/anafrancisconi_Sp04AfFCPNM.jpg",
"created_at": "2020-04-10 13:31:04",
"updated_at": "2020-04-10 13:31:04",
"created_by": 1,
"updated_by": 1,
"path": "/uploads/images/cover_book/2020-04/anafrancisconi_Sp04AfFCPNM.jpg",
"type": "cover_book",
"uploaded_to": 14
},
"books": [
{
"id": 5,
"name": "Sint explicabo alias sunt.",
"slug": "jbsQrzuaXe"
},
{
"id": 1,
"name": "BookStack User Guide",
"slug": "bookstack-user-guide"
},
{
"id": 3,
"name": "Molestiae doloribus sint velit suscipit dolorem.",
"slug": "H99QxALaoG"
}
]
}

View File

@ -0,0 +1,11 @@
{
"id": 14,
"name": "My updated shelf",
"slug": "my-updated-shelf",
"description": "This is my update shelf with some books",
"created_by": 1,
"updated_by": 1,
"image_id": 501,
"created_at": "2020-04-10 13:24:09",
"updated_at": "2020-04-10 13:48:22"
}