feat: adding series write endpoints (#22)

This commit is contained in:
paranarimasu authored and GitHub committed 2022-05-26 13:52:49 -05:00
1 parent 71f5d84523
commit 124ad52ea0
6 files changed
+251 -4

No files matched your search

+18 -2
View File
@@ -233,12 +233,28 @@ module.exports = {
to: '/series',
children: [
{
title: 'Show',
to: '/series/show/',
title: 'Destroy',
to: '/series/destroy/'
},
{
title: 'Force Delete',
to: '/series/forceDelete/'
},
{
title: 'Index',
to: '/series/index/'
},
{
title: 'Show',
to: '/series/show/',
},
{
title: 'Store',
to: '/series/store/',
},
{
title: 'Update',
to: '/series/update/',
}
]
},
+18 -2
View File
@@ -27,10 +27,26 @@ For example, the Monogatari series is the collection of the Bakemonogatari anime
### Endpoints
**[Series Destroy](/series/destroy/)**
The series destroy endpoint soft deletes a series and returns the deleted series resource.
**[Series Force Delete](/series/forceDelete/)**
The series force delete endpoint hard deletes a series and returns a confirmation message.
**[Series Index](/series/index/)**
The series index endpoint displays a listing of series resources.
**[Series Show](/series/show/)**
The series show endpoint returns a series resource.
**[Series Index](/series/index/)**
**[Series Store](/series/store/)**
The series index endpoint displays a listing of series resources.
The series store endpoint creates a new series and returns the new series resource.
**[Series Update](/series/update/)**
The series update endpoint updates a series and returns the updated series resource.
+54
View File
@@ -0,0 +1,54 @@
---
title: Series Destroy
---
<Block>
# Series Destroy Endpoint
The series destroy endpoint soft deletes a series and returns the deleted series resource.
For example, the `/api/series/monogatari` endpoint will soft delete the Monogatari series and return the deleted Monogatari resource.
## URL
```sh
DELETE /api/series/{slug}
```
## Authentication
**Required Permission**: delete series
**Roles with Permission**: Wiki Editor, Admin
## Parameters
None
## Response
```json
{
series: {
id: id,
name: "name",
slug: "slug",
created_at: "created_at",
updated_at: "updated_at",
deleted_at: "deleted_at"
}
}
```
<Example>
<CURL>
```bash
curl -X DELETE -H "Authorization: Bearer {token}" https://staging.animethemes.moe/api/series/monogatari
```
</CURL>
</Example>
</Block>
+47
View File
@@ -0,0 +1,47 @@
---
title: Series Force Delete
---
<Block>
# Series Force Delete Endpoint
The series force delete endpoint hard deletes a series and returns a confirmation message.
For example, the `/api/forceDelete/series/monogatari` endpoint will hard delete the Monogatari series and return a confirmation message.
## URL
```sh
DELETE /api/forceDelete/series/{slug}
```
## Authentication
**Required Permission**: force delete series
**Roles with Permission**: Admin
## Parameters
None
## Response
```json
{
message: "The Series 'Monogatari' was deleted.",
}
```
<Example>
<CURL>
```bash
curl -X DELETE -H "Authorization: Bearer {token}" https://staging.animethemes.moe/api/forceDelete/series/monogatari
```
</CURL>
</Example>
</Block>
+57
View File
@@ -0,0 +1,57 @@
---
title: Series Store
---
<Block>
# Series Store Endpoint
The series store endpoint creates a new series and returns the new series resource.
For example, the `/api/series?name=Monogatari&slug=monogatari` endpoint will create a new Monogatari series and return the new Monogatari resource.
## URL
```sh
POST /api/series
```
## Authentication
**Required Permission**: create series
**Roles with Permission**: Wiki Editor, Admin
## Parameters
| Name | Required | Rules |
| :------: | :------: | :---------------------------------- |
| name | Yes | string, max:192 |
| slug | Yes | string, max:192, alpha_dash, unique |
## Response
```json
{
series: {
id: id,
name: "name",
slug: "slug",
created_at: "created_at",
updated_at: "updated_at",
deleted_at: "deleted_at"
}
}
```
<Example>
<CURL>
```bash
curl -X POST -H "Authorization: Bearer {token}" https://staging.animethemes.moe/api/series/
```
</CURL>
</Example>
</Block>
+57
View File
@@ -0,0 +1,57 @@
---
title: Series Update
---
<Block>
# Series Update Endpoint
The series update endpoint updates a series and returns the updated series resource.
For example, the `/api/series/monogatari?name=Monogatari` endpoint will update the Monogatari series name attribute and return the updated Monogatari resource.
## URL
```sh
PUT|PATCH /api/series/{slug}
```
## Authentication
**Required Permission**: update series
**Roles with Permission**: Wiki Editor, Admin
## Parameters
| Name | Required | Rules |
| :------: | :------: | :---------------------------------- |
| name | Yes | string, max:192 |
| slug | Yes | string, max:192, alpha_dash, unique |
## Response
```json
{
series: {
id: id,
name: "name",
slug: "slug",
created_at: "created_at",
updated_at: "updated_at",
deleted_at: "deleted_at"
}
}
```
<Example>
<CURL>
```bash
curl -X PATCH -H "Authorization: Bearer {token}" https://staging.animethemes.moe/api/series/monogatari
```
</CURL>
</Example>
</Block>