feat: adding artist write endpoints (#21)

This commit is contained in:
paranarimasu authored and GitHub committed 2022-05-25 19:54:48 -05:00
1 parent 16d74c7129
commit 71f5d84523
7 files changed
+252 -5

No files matched your search

+18 -2
View File
@@ -127,12 +127,28 @@ module.exports = {
to: '/artist',
children: [
{
title: 'Show',
to: '/artist/show/',
title: 'Destroy',
to: '/artist/destroy/'
},
{
title: 'Force Delete',
to: '/artist/forceDelete/'
},
{
title: 'Index',
to: '/artist/index/'
},
{
title: 'Show',
to: '/artist/show/',
},
{
title: 'Store',
to: '/artist/store/',
},
{
title: 'Update',
to: '/artist/update/',
}
]
},
+1 -1
View File
@@ -57,7 +57,7 @@ The anime show endpoint returns an anime resource.
**[Anime Store](/anime/store/)**
The anime store endpoints create a new anime and returns the new anime resource.
The anime store endpoint creates a new anime and returns the new anime resource.
**[Anime Update](/anime/update/)**
+18 -2
View File
@@ -34,10 +34,26 @@ For example, Chiwa Saito is the musical performer of the Bakemonogatari OP1 them
### Endpoints
**[Artist Destroy](/artist/destroy/)**
The artist destroy endpoint soft deletes an artist and returns the deleted artist resource.
**[Artist Force Delete](/artist/forceDelete/)**
The artist force delete endpoint hard deletes an artist and returns a confirmation message.
**[Artist Index](/artist/index/)**
The artist index endpoint displays a listing of artist resources.
**[Artist Show](/artist/show/)**
The artist show endpoint returns an artist resource.
**[Artist Index](/artist/index/)**
**[Artist Store](/artist/store/)**
The artist index endpoint displays a listing of artist resources.
The artist store endpoint creates a new artist and returns the new artist resource.
**[Artist Update](/artist/update/)**
The artist update endpoint updates an artist and returns the updated artist resource.
+54
View File
@@ -0,0 +1,54 @@
---
title: Artist Destroy
---
<Block>
# Artist Destroy Endpoint
The artist destroy endpoint soft deletes an artist and returns the deleted artist resource.
For example, the `/api/artist/chiwa_saito` endpoint will soft delete the Chiwa Saito artist and return the deleted Chiwa Saito resource.
## URL
```sh
DELETE /api/artist/{slug}
```
## Authentication
**Required Permission**: delete artist
**Roles with Permission**: Wiki Editor, Admin
## Parameters
None
## Response
```json
{
artist: {
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/artist/chiwa_saito
```
</CURL>
</Example>
</Block>
+47
View File
@@ -0,0 +1,47 @@
---
title: Artist Force Delete
---
<Block>
# Artist Force Delete Endpoint
The artist force delete endpoint hard deletes an artist and returns a confirmation message.
For example, the `/api/forceDelete/artist/chiwa_saito` endpoint will hard delete the Chiwa Saito artist and return a confirmation message.
## URL
```sh
DELETE /api/forceDelete/artist/{slug}
```
## Authentication
**Required Permission**: force delete artist
**Roles with Permission**: Admin
## Parameters
None
## Response
```json
{
message: "The Artist 'Chiwa Saito' was deleted.",
}
```
<Example>
<CURL>
```bash
curl -X DELETE -H "Authorization: Bearer {token}" https://staging.animethemes.moe/api/forceDelete/artist/chiwa_saito
```
</CURL>
</Example>
</Block>
+57
View File
@@ -0,0 +1,57 @@
---
title: Artist Store
---
<Block>
# Artist Store Endpoint
The artist store endpoint creates a new artist and returns the new artist resource.
For example, the `/api/artist?name=Chiwa+Saito&slug=chiwa_saito` endpoint will create a new Chiwa Saito artist and return the new Chiwa Saito resource.
## URL
```sh
POST /api/artist
```
## Authentication
**Required Permission**: create artist
**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
{
artist: {
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/artist/
```
</CURL>
</Example>
</Block>
+57
View File
@@ -0,0 +1,57 @@
---
title: Artist Update
---
<Block>
# Artist Update Endpoint
The artist update endpoint updates an artist and returns the updated artist resource.
For example, the `/api/artist/chiwa_saito?name=Chiwa+Saito` endpoint will update the Chiwa Saito artist name attribute and return the updated Chiwa Saito resource.
## URL
```sh
PUT|PATCH /api/artist/{slug}
```
## Authentication
**Required Permission**: update artist
**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
{
artist: {
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/artist/chiwa_saito
```
</CURL>
</Example>
</Block>