feat: adding synonym write endpoints (#33)

This commit is contained in:
paranarimasu
2022-06-11 23:59:34 -05:00
committed by GitHub
parent 436f9c83fe
commit dc1b6a09e6
8 changed files with 257 additions and 13 deletions
+18 -2
View File
@@ -71,12 +71,28 @@ module.exports = {
to: '/animesynonym',
children: [
{
title: 'Show',
to: '/animesynonym/show/',
title: 'Destroy',
to: '/animesynonym/destroy/'
},
{
title: 'Force Delete',
to: '/animesynonym/forceDelete/'
},
{
title: 'Index',
to: '/animesynonym/index/'
},
{
title: 'Show',
to: '/animesynonym/show/',
},
{
title: 'Store',
to: '/animesynonym/store/',
},
{
title: 'Update',
to: '/animesynonym/update/',
}
]
},
+20 -4
View File
@@ -26,10 +26,26 @@ For example, the anime Bakemonogatari has the AnimeSynonym "Monstory".
### Endpoints
**[AnimeSynonym Show](/animesynonym/show/)**
**[Anime Synonym Destroy](/animesynonym/destroy/)**
The AnimeSynonym show endpoint returns an AnimeSynonym resource.
The anime synonym destroy endpoint soft deletes an anime synonym and returns the deleted anime synonym resource.
**[AnimeSynonym Index](/animesynonym/index/)**
**[Anime Synonym Force Delete](/animesynonym/forceDelete/)**
The AnimeSynonym index endpoint displays a listing of AnimeSynonym resources.
The anime synonym force delete endpoint hard deletes an anime synonym and returns a confirmation message.
**[Anime Synonym Index](/animesynonym/index/)**
The anime synonym index endpoint displays a listing of anime synonym resources.
**[Anime Synonym Show](/animesynonym/show/)**
The anime synonym show endpoint returns an anime synonym resource.
**[Anime Synonym Store](/animesynonym/store/)**
The anime synonym store endpoint creates a new anime synonym and returns the new anime synonym resource.
**[Anime Synonym Update](/animesynonym/update/)**
The anime synonym update endpoint updates an anime synonym and returns the updated anime synonym resource.
+53
View File
@@ -0,0 +1,53 @@
---
title: Anime Synonym Destroy
---
<Block>
# Anime Synonym Destroy Endpoint
The anime synonym destroy endpoint soft deletes an anime synonym and returns the deleted anime synonym resource.
For example, the `/api/animesynonym/1523` endpoint will soft delete the Monstory synonym for the Bakemonogatari anime and return the deleted anime synonym resource.
## URL
```sh
DELETE /api/animesynonym/{id}
```
## Authentication
**Required Permission**: delete anime synonym
**Roles with Permission**: Wiki Editor, Admin
## Parameters
None
## Response
```json
{
animesynonym: {
id: id,
text: "text",
created_at: "created_at",
updated_at: "updated_at",
deleted_at: "deleted_at"
}
}
```
<Example>
<CURL>
```bash
curl -X DELETE -H "Authorization: Bearer {token}" https://api.animethemes.moe/animesynonym/1523
```
</CURL>
</Example>
</Block>
+47
View File
@@ -0,0 +1,47 @@
---
title: Anime Synonym Force Delete
---
<Block>
# Anime Synonym Force Delete Endpoint
The anime synonym force delete endpoint hard deletes an anime synonym and returns a confirmation message.
For example, the `/api/forceDelete/animesynonym/1523` endpoint will hard delete the Monstory synonym for the Bakemonogatari anime and return a confirmation message.
## URL
```sh
DELETE /api/forceDelete/animesynonym/{id}
```
## Authentication
**Required Permission**: force delete anime synonym
**Roles with Permission**: Admin
## Parameters
None
## Response
```json
{
message: "The AnimeSynonym 'Monstory' was deleted.",
}
```
<Example>
<CURL>
```bash
curl -X DELETE -H "Authorization: Bearer {token}" https://api.animethemes.moe/forceDelete/animesynonym/1523
```
</CURL>
</Example>
</Block>
+3 -3
View File
@@ -1,12 +1,12 @@
---
title: AnimeSynonym Index
title: Anime Synonym Index
---
<Block>
# AnimeSynonym Index Endpoint
# Anime Synonym Index Endpoint
The AnimeSynonym index endpoint returns a listing of AnimeSynonym resources.
The anime synonym index endpoint returns a listing of anime synonym resources.
## URL
+4 -4
View File
@@ -1,14 +1,14 @@
---
title: AnimeSynonym Show
title: Anime Synonym Show
---
<Block>
# AnimeSynonym Show Endpoint
# Anime Synonym Show Endpoint
The AnimeSynonym show endpoint returns an AnimeSynonym resource.
The anime synonym show endpoint returns an anime synonym resource.
For example, the `/api/animesynonym/1523` endpoint will return the AnimeSynonym resource "Monstory" for the anime Bakemonogatari.
For example, the `/api/animesynonym/1523` endpoint will return the Monstory synonym for the anime Bakemonogatari.
## URL
+56
View File
@@ -0,0 +1,56 @@
---
title: Anime Synonym Store
---
<Block>
# Anime Synonym Store Endpoint
The anime synonym store endpoint creates a new anime synonym and returns the new anime synonym resource.
For example, the `/api/animesynonym?anime_id=218&text=Monstory` endpoint will create a new Monstory synonym for the Bakemonogatari anime and return the new anime synonym resource.
## URL
```sh
POST /api/animesynonym
```
## Authentication
**Required Permission**: create anime synonym
**Roles with Permission**: Wiki Editor, Admin
## Parameters
| Name | Required | Rules |
| :------: | :------: | :----------------------- |
| anime_id | Yes | integer, Anime ID exists |
| text | Yes | string, max:192 |
## Response
```json
{
animesynonym: {
id: id,
text: "text",
created_at: "created_at",
updated_at: "updated_at",
deleted_at: "deleted_at"
}
}
```
<Example>
<CURL>
```bash
curl -X POST -H "Authorization: Bearer {token}" https://api.animethemes.moe/animesynonym/
```
</CURL>
</Example>
</Block>
+56
View File
@@ -0,0 +1,56 @@
---
title: Anime Synonym Update
---
<Block>
# Anime Synonym Update Endpoint
The anime synonym update endpoint updates an anime synonym and returns the updated anime synonym resource.
For example, the `/api/animesynonym/1523?text=Monstory` endpoint will update the Monstory anime synonym text attribute and return the updated anime synonym resource.
## URL
```sh
PUT|PATCH /api/animesynonym/{id}
```
## Authentication
**Required Permission**: update anime synonym
**Roles with Permission**: Wiki Editor, Admin
## Parameters
| Name | Required | Rules |
| :------: | :------: | :----------------------- |
| anime_id | No | integer, Anime ID exists |
| text | No | string, max:192 |
## Response
```json
{
animesynonym: {
id: id,
text: "text",
created_at: "created_at",
updated_at: "updated_at",
deleted_at: "deleted_at"
}
}
```
<Example>
<CURL>
```bash
curl -X PATCH -H "Authorization: Bearer {token}" https://api.animethemes.moe/animesynonym/1523
```
</CURL>
</Example>
</Block>