feat: adding announcement write endpoints (#29)

This commit is contained in:
paranarimasu
2022-06-08 15:09:58 -05:00
committed by GitHub
parent bb848e0e93
commit 73145b6ad2
7 changed files with 270 additions and 28 deletions
+18 -2
View File
@@ -113,12 +113,28 @@ module.exports = {
to: '/announcement',
children: [
{
title: 'Show',
to: '/announcement/show/',
title: 'Destroy',
to: '/announcement/destroy/'
},
{
title: 'Force Delete',
to: '/announcement/forceDelete/'
},
{
title: 'Index',
to: '/announcement/index/'
},
{
title: 'Show',
to: '/announcement/show/',
},
{
title: 'Store',
to: '/announcement/store/',
},
{
title: 'Update',
to: '/announcement/update/',
}
]
},
+18 -2
View File
@@ -26,10 +26,26 @@ None
### Endpoints
**[Announcement Destroy](/announcement/destroy/)**
The announcement destroy endpoint soft deletes an announcement and returns the deleted announcement resource.
**[Announcement Force Delete](/announcement/forceDelete/)**
The announcement force delete endpoint hard deletes an announcement and returns a confirmation message.
**[Announcement Index](/announcement/index/)**
The announcement index endpoint displays a listing of announcement resources.
**[Announcement Show](/announcement/show/)**
The announcement show endpoint returns an announcement resource.
**[Announcement Index](/announcement/index/)**
**[Announcement Store](/announcement/store/)**
The announcement index endpoint displays a listing of announcement resources.
The announcement store endpoint creates a new announcement and returns the new announcement resource.
**[Announcement Update](/announcement/update/)**
The announcement update endpoint updates an announcement and returns the updated announcement resource.
+53
View File
@@ -0,0 +1,53 @@
---
title: Announcement Destroy
---
<Block>
# Announcement Destroy Endpoint
The announcement destroy endpoint soft deletes an announcement and returns the deleted announcement resource.
For example, the `/api/announcement/1` endpoint will soft delete the announcement of id '1' and return the deleted announcement resource.
## URL
```sh
DELETE /api/announcement/{id}
```
## Authentication
**Required Permission**: delete announcement
**Roles with Permission**: Admin
## Parameters
None
## Response
```json
{
announcement: {
id: id,
content: "content",
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/announcement/1
```
</CURL>
</Example>
</Block>
+47
View File
@@ -0,0 +1,47 @@
---
title: Announcement Force Delete
---
<Block>
# Announcement Force Delete Endpoint
The announcement force delete endpoint hard deletes an announcement and returns a confirmation message.
For example, the `/api/forceDelete/announcement/1` endpoint will hard delete the announcement of id '1' and return a confirmation message.
## URL
```sh
DELETE /api/forceDelete/announcement/{id}
```
## Authentication
**Required Permission**: force delete announcement
**Roles with Permission**: Admin
## Parameters
None
## Response
```json
{
message: "The Announcement '1' was deleted.",
}
```
<Example>
<CURL>
```bash
curl -X DELETE -H "Authorization: Bearer {token}" https://api.animethemes.moe/forceDelete/announcement/1
```
</CURL>
</Example>
</Block>
+55
View File
@@ -0,0 +1,55 @@
---
title: Announcement Store
---
<Block>
# Announcement Store Endpoint
The announcement store endpoint creates a new announcement and returns the new announcement resource.
For example, the `/api/announcement?content=The+Release+Has+Been+Deployed!` endpoint will create a new announcement and return the new announcement resource.
## URL
```sh
POST /api/announcement
```
## Authentication
**Required Permission**: create announcement
**Roles with Permission**: Admin
## Parameters
| Name | Required | Rules |
| :-----: | :------: | :---------------- |
| content | Yes | string, max:65535 |
## Response
```json
{
announcement: {
id: id,
content: "content",
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/announcement/
```
</CURL>
</Example>
</Block>
+55
View File
@@ -0,0 +1,55 @@
---
title: Announcement Update
---
<Block>
# Announcement Update Endpoint
The announcement update endpoint updates an announcement and returns the updated announcement resource.
For example, the `/api/announcement/1?content=The+Release+Has+Been+Deployed!` endpoint will update the announcement content attribute and return the updated announcement resource.
## URL
```sh
PUT|PATCH /api/announcement/{id}
```
## Authentication
**Required Permission**: update announcement
**Roles with Permission**: Admin
## Parameters
| Name | Required | Rules |
| :-----: | :------: | :---------------- |
| content | No | string, max:65535 |
## Response
```json
{
announcement: {
id: id,
content: "content",
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/announcement/1
```
</CURL>
</Example>
</Block>
+24 -24
View File
@@ -4010,9 +4010,9 @@
}
},
"node_modules/caniuse-lite": {
"version": "1.0.30001349",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001349.tgz",
"integrity": "sha512-VFaWW3jeo6DLU5rwdiasosxhYSduJgSGil4cSyX3/85fbctlE58pXAkWyuRmVA0r2RxsOSVYUTZcySJ8WpbTxw==",
"version": "1.0.30001350",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001350.tgz",
"integrity": "sha512-NZBql38Pzd+rAu5SPXv+qmTWGQuFsRiemHCJCAPvkoDxWV19/xqL2YHF32fDJ9SDLdLqfax8+S0CO3ncDCp9Iw==",
"dev": true,
"funding": [
{
@@ -6975,14 +6975,14 @@
}
},
"node_modules/get-intrinsic": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz",
"integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==",
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.2.tgz",
"integrity": "sha512-Jfm3OyCxHh9DJyc28qGk+JmfkpO41A4XkneDSujN9MDXrm4oDKdHvndhZ2dN94+ERNfkYJWDclW6k2L/ZGHjXA==",
"dev": true,
"dependencies": {
"function-bind": "^1.1.1",
"has": "^1.0.3",
"has-symbols": "^1.0.1"
"has-symbols": "^1.0.3"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
@@ -11847,7 +11847,7 @@
"node_modules/serve-index": {
"version": "1.9.1",
"resolved": "https://registry.npmjs.org/serve-index/-/serve-index-1.9.1.tgz",
"integrity": "sha1-03aNabHn2C5c4FD/9bRTvqEqkjk=",
"integrity": "sha512-pXHfKNP4qujrtteMrSBb0rc8HJ9Ms/GrXwcUtUtD5s4ewDJI8bT3Cz2zTVRMKtri49pLx2e0Ya8ziP5Ya2pZZw==",
"dev": true,
"dependencies": {
"accepts": "~1.3.4",
@@ -11940,7 +11940,7 @@
"node_modules/set-blocking": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
"integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=",
"integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==",
"dev": true
},
"node_modules/set-value": {
@@ -11961,7 +11961,7 @@
"node_modules/setimmediate": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz",
"integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=",
"integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==",
"dev": true
},
"node_modules/setprototypeof": {
@@ -11986,7 +11986,7 @@
"node_modules/shebang-command": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz",
"integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=",
"integrity": "sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==",
"dependencies": {
"shebang-regex": "^1.0.0"
},
@@ -11997,7 +11997,7 @@
"node_modules/shebang-regex": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz",
"integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=",
"integrity": "sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==",
"engines": {
"node": ">=0.10.0"
}
@@ -18111,9 +18111,9 @@
}
},
"caniuse-lite": {
"version": "1.0.30001349",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001349.tgz",
"integrity": "sha512-VFaWW3jeo6DLU5rwdiasosxhYSduJgSGil4cSyX3/85fbctlE58pXAkWyuRmVA0r2RxsOSVYUTZcySJ8WpbTxw==",
"version": "1.0.30001350",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001350.tgz",
"integrity": "sha512-NZBql38Pzd+rAu5SPXv+qmTWGQuFsRiemHCJCAPvkoDxWV19/xqL2YHF32fDJ9SDLdLqfax8+S0CO3ncDCp9Iw==",
"dev": true
},
"caseless": {
@@ -20450,14 +20450,14 @@
"dev": true
},
"get-intrinsic": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz",
"integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==",
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.2.tgz",
"integrity": "sha512-Jfm3OyCxHh9DJyc28qGk+JmfkpO41A4XkneDSujN9MDXrm4oDKdHvndhZ2dN94+ERNfkYJWDclW6k2L/ZGHjXA==",
"dev": true,
"requires": {
"function-bind": "^1.1.1",
"has": "^1.0.3",
"has-symbols": "^1.0.1"
"has-symbols": "^1.0.3"
}
},
"get-stream": {
@@ -24377,7 +24377,7 @@
"serve-index": {
"version": "1.9.1",
"resolved": "https://registry.npmjs.org/serve-index/-/serve-index-1.9.1.tgz",
"integrity": "sha1-03aNabHn2C5c4FD/9bRTvqEqkjk=",
"integrity": "sha512-pXHfKNP4qujrtteMrSBb0rc8HJ9Ms/GrXwcUtUtD5s4ewDJI8bT3Cz2zTVRMKtri49pLx2e0Ya8ziP5Ya2pZZw==",
"dev": true,
"requires": {
"accepts": "~1.3.4",
@@ -24457,7 +24457,7 @@
"set-blocking": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
"integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=",
"integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==",
"dev": true
},
"set-value": {
@@ -24475,7 +24475,7 @@
"setimmediate": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz",
"integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=",
"integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==",
"dev": true
},
"setprototypeof": {
@@ -24497,7 +24497,7 @@
"shebang-command": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz",
"integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=",
"integrity": "sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==",
"requires": {
"shebang-regex": "^1.0.0"
}
@@ -24505,7 +24505,7 @@
"shebang-regex": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz",
"integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM="
"integrity": "sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ=="
},
"side-channel": {
"version": "1.0.4",