feat: adding studio write endpoints (#24)

This commit is contained in:
paranarimasu authored and GitHub committed 2022-06-02 15:59:00 -05:00
1 parent 57dd7eecd7
commit 21922aeb61
8 files changed
+1009 -746

No files matched your search

+1 -1
View File
@@ -69,7 +69,7 @@ Create Pull Request from the new feature branch to the upstream main branch.
Once the Pull Request is merged, delete the feature branch locally.
`git branch -d new-feature-branch`
`git branch --delete new-feature-branch`
Delete the remote feature branch.
+18 -2
View File
@@ -277,12 +277,28 @@ module.exports = {
to: '/studio',
children: [
{
title: 'Show',
to: '/studio/show/',
title: 'Destroy',
to: '/studio/destroy/'
},
{
title: 'Force Delete',
to: '/studio/forceDelete/'
},
{
title: 'Index',
to: '/studio/index/'
},
{
title: 'Show',
to: '/studio/show/',
},
{
title: 'Store',
to: '/studio/store/',
},
{
title: 'Update',
to: '/studio/update/',
}
]
},
+18 -2
View File
@@ -28,10 +28,26 @@ For example, Shaft is the studio that produced the anime Bakemonogatari.
### Endpoints
**[Studio Destroy](/studio/destroy/)**
The studio destroy endpoint soft deletes a studio and returns the deleted studio resource.
**[Studio Force Delete](/studio/forceDelete/)**
The studio force delete endpoint hard deletes a studio and returns a confirmation message.
**[Studio Index](/studio/index/)**
The studio index endpoint displays a listing of studio resources.
**[Studio Show](/studio/show/)**
The studio show endpoint returns a studio resource.
**[Studio Index](/studio/index/)**
**[Studio Store](/studio/store/)**
The studio index endpoint displays a listing of studio resources.
The studio store endpoint creates a new studio and returns the new studio resource.
**[Studio Update](/studio/update/)**
The studio update endpoint updates a studio and returns the updated studio resource.
+54
View File
@@ -0,0 +1,54 @@
---
title: Studio Destroy
---
<Block>
# Studio Destroy Endpoint
The studio destroy endpoint soft deletes a studio and returns the deleted studio resource.
For example, the `/api/studio/shaft` endpoint will soft delete the Shaft studio and return the deleted Shaft resource.
## URL
```sh
DELETE /api/studio/{slug}
```
## Authentication
**Required Permission**: delete studio
**Roles with Permission**: Wiki Editor, Admin
## Parameters
None
## Response
```json
{
studio: {
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://api.animethemes.moe/studio/shaft
```
</CURL>
</Example>
</Block>
+47
View File
@@ -0,0 +1,47 @@
---
title: Studio Force Delete
---
<Block>
# Studio Force Delete Endpoint
The studio force delete endpoint hard deletes a studio and returns a confirmation message.
For example, the `/api/forceDelete/studio/shaft` endpoint will hard delete the Shaft studio and return a confirmation message.
## URL
```sh
DELETE /api/forceDelete/studio/{slug}
```
## Authentication
**Required Permission**: force delete studio
**Roles with Permission**: Admin
## Parameters
None
## Response
```json
{
message: "The Studio 'Shaft' was deleted.",
}
```
<Example>
<CURL>
```bash
curl -X DELETE -H "Authorization: Bearer {token}" https://api.animethemes.moe/forceDelete/studio/shaft
```
</CURL>
</Example>
</Block>
+57
View File
@@ -0,0 +1,57 @@
---
title: Studio Store
---
<Block>
# Studio Store Endpoint
The studio store endpoint creates a new studio and returns the new studio resource.
For example, the `/api/studio?name=Shaft&slug=shaft` endpoint will create a new Shaft studio and return the new Shaft resource.
## URL
```sh
POST /api/studio
```
## Authentication
**Required Permission**: create studio
**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
{
studio: {
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://api.animethemes.moe/studio/
```
</CURL>
</Example>
</Block>
+57
View File
@@ -0,0 +1,57 @@
---
title: Studio Update
---
<Block>
# Studio Update Endpoint
The studio update endpoint updates a studio and returns the updated studio resource.
For example, the `/api/studio/shaft?name=Shaft` endpoint will update the Shaft studio name attribute and return the updated Shaft resource.
## URL
```sh
PUT|PATCH /api/studio/{slug}
```
## Authentication
**Required Permission**: update studio
**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
{
studio: {
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://api.animethemes.moe/studio/shaft
```
</CURL>
</Example>
</Block>
+757 -741
View File
File diff suppressed because it is too large. Load diff