Merge pull request #46 from paranarimasu/dump-resource

feat: adding dump resource and feature flag
This commit is contained in:
paranarimasu authored and GitHub committed 2022-09-19 11:54:23 -05:00
commit 95cbd5e6c5
12 files changed
+831 -390

No files matched your search

+13
View File
@@ -145,6 +145,19 @@ export default {
{ text: 'Update', link: '/balance/update/' },
]
},
{
text: 'Dump',
collapsible: true,
items: [
{ text: 'Resource', link: '/dump/' },
{ text: 'Destroy', link: '/dump/destroy/' },
{ text: 'Force Delete', link: '/dump/forceDelete/' },
{ text: 'Index', link: '/dump/index/' },
{ text: 'Show', link: '/dump/show/' },
{ text: 'Store', link: '/dump/store/' },
{ text: 'Update', link: '/dump/update/' },
]
},
{
text: 'Feature Flags',
collapsible: true,
+1
View File
@@ -16,6 +16,7 @@ The config flags API resource contains the list of feature flags that enable/dis
| allow_audio_streams | Boolean | No | Enable/Disable audio streaming |
| allow_discord_notifications | Boolean | No | Enable/Disable discord notifications for the configured bot |
| allow_view_recording | Boolean | No | Enable/Disable the recording of views for view counts |
| allow_dump_downloading | Boolean | No | Enable/Disable database dump downloading |
### Allowed Include Paths
+1
View File
@@ -31,6 +31,7 @@ None
allow_audio_streams: allow_audio_streams,
allow_discord_notifications: allow_discord_notifications,
allow_view_recording: allow_view_recording,
allow_dump_downloading: allow_dump_downloading
}
}
```
+46
View File
@@ -0,0 +1,46 @@
---
title: Dump Destroy
---
# Dump Destroy Endpoint
The dump destroy endpoint soft deletes a dump and returns the deleted dump resource.
For example, the `/dump/1` endpoint will soft delete the dump of id '1' and return the deleted dump resource.
## URL
```sh
DELETE /dump/{id}
```
## Authentication
**Required Permission**: delete dump
**Roles with Permission**: Admin
## Parameters
None
## Response
```json
{
dump: {
id: id,
path: "path",
created_at: "created_at",
updated_at: "updated_at",
deleted_at: "deleted_at",
link: "link
}
}
```
## Example
```bash
curl -X DELETE -H "Authorization: Bearer {token}" https://api.animethemes.moe/dump/1
```
+39
View File
@@ -0,0 +1,39 @@
---
title: Dump Force Delete
---
# Dump Force Delete Endpoint
The dump force delete endpoint hard deletes a dump and returns a confirmation message.
For example, the `/forceDelete/dump/1` endpoint will hard delete the dump of id '1' and return a confirmation message.
## URL
```sh
DELETE /forceDelete/dump/{id}
```
## Authentication
**Required Permission**: force delete dump
**Roles with Permission**: Admin
## Parameters
None
## Response
```json
{
message: "The Dump '1' was deleted.",
}
```
## Example
```bash
curl -X DELETE -H "Authorization: Bearer {token}" https://api.animethemes.moe/forceDelete/dump/1
```
+52
View File
@@ -0,0 +1,52 @@
---
title: Dump
---
# Dump
---
A dump API resource represents a database dump of selected tables at a given point in time.
For example, the animethemes-db-dump-wiki-1663559663946.sql dump represents the database dump of wiki tables performed at 2022-09-19.
### Fields
| Name | Type | Nullable | Description |
| :--------: | :-----: | :------: | :--------------------------------------------|
| id | Integer | No | The primary key of the resource |
| path | String | No | The path of the file in storage |
| created_at | Date | No | The date that the resource was created |
| updated_at | Date | No | The date that the resource was last modified |
| deleted_at | Date | Yes | The date that the resource was deleted |
| link | String | No | The URL to download the file from storage |
### Allowed Include Paths
None
### Endpoints
**[Dump Destroy](/dump/destroy/)**
The dump destroy endpoint soft deletes a dump and returns the deleted dump resource.
**[Dump Force Delete](/dump/forceDelete/)**
The dump force delete endpoint hard deletes a dump and returns a confirmation message.
**[Dump Index](/dump/index/)**
The dump index endpoint displays a listing of dump resources.
**[Dump Show](/dump/show/)**
The dump show endpoint returns a dump resource.
**[Dump Store](/dump/store/)**
The dump store endpoint creates a new dump and returns the new dump resource.
**[Dump Update](/dump/update/)**
The dump update endpoint updates a dump and returns the updated dump resource.
+86
View File
@@ -0,0 +1,86 @@
---
title: Dump Index
---
# Dump Index Endpoint
The dump index endpoint returns a listing of dump resources.
## URL
```sh
GET /dump/
```
## Authentication
None
## Parameters
| Name | Required | Description |
| :----------: | :------: | :----------------------------------------------------------- |
| fields | No | Sparse fieldsets for resource types |
| filter | No | Filters for dump resources |
| page[number] | No | The page of dump resources to display |
| page[size] | No | The number of dump resources to display for the current page |
| sort | No | The list of fields to sort the dump resources |
## Allowed Sort Fields
| Name | Description |
| :--------: | :------------------------------------------------------------------ |
| id | Sort resources on the primary key |
| path | Sort resources on the path of the file in storage |
| created_at | Sort resources on the resource creation date |
| updated_at | Sort resources on the resource last modified date |
| deleted_at | Sort resources on the resource deletion date |
| random | Sort resources randomly. Ignored if other sort fields are provided. |
## Filters
| Name | Description |
| :--------: | :----------------------------------------------------------------- |
| id | Filter resources on the primary key |
| path | Filter resources on the path of the file in storage |
| created_at | Filter resources on the resource creation date |
| updated_at | Filter resources on the resource last modified date |
| deleted_at | Filter resources on the resource deletion date |
| trashed | Filter resources on trashed (deleted) status [With, Without, Only] |
## Response
```json
{
dumps: [
{
id: id,
path: "path",
created_at: "created_at",
updated_at: "updated_at",
deleted_at: "deleted_at",
link: "link"
},
...
],
links: {
first: "first",
last: "last",
prev: "prev",
next: "next"
},
meta: {
current_page: current_page,
from: from,
path: "path",
per_page: per_page,
to: to
}
}
```
## Example
```bash
curl https://api.animethemes.moe/dump/
```
+44
View File
@@ -0,0 +1,44 @@
---
title: Dump Show
---
# Dump Show Endpoint
The dump show endpoint returns a dump resource.
## URL
```sh
GET /dump/{id}
```
## Authentication
None
## Parameters
| Name | Required | Description |
| :-----: | :------: | :------------------------------------------------------ |
| fields | No | Sparse fieldsets for resource types |
## Response
```json
{
dump: {
id: id,
path: "path",
created_at: "created_at",
updated_at: "updated_at",
deleted_at: "deleted_at",
link: "link"
}
}
```
## Example
```bash
curl https://api.animethemes.moe/dump/1
```
+48
View File
@@ -0,0 +1,48 @@
---
title: Dump Store
---
# Dump Store Endpoint
The dump store endpoint creates a new dump and returns the new dump resource.
For example, the `/dump?path=animethemes-db-dump-wiki-1663559663946.sql` endpoint will create a new dump and return the new dump resource.
## URL
```sh
POST /dump
```
## Authentication
**Required Permission**: create dump
**Roles with Permission**: Admin
## Parameters
| Name | Required | Rules |
| :-----: | :------: | :---------------- |
| path | Yes | string, max:192 |
## Response
```json
{
dump: {
id: id,
path: "path",
created_at: "created_at",
updated_at: "updated_at",
deleted_at: "deleted_at",
link: "link"
}
}
```
## Example
```bash
curl -X POST -H "Authorization: Bearer {token}" https://api.animethemes.moe/dump/
```
+48
View File
@@ -0,0 +1,48 @@
---
title: Dump Update
---
# Dump Update Endpoint
The dump update endpoint updates a dump and returns the updated dump resource.
For example, the `/dump/1?path=animethemes-db-dump-wiki-1663559663946.sql` endpoint will update the dump path attribute and return the updated dump resource.
## URL
```sh
PUT|PATCH /dump/{id}
```
## Authentication
**Required Permission**: update dump
**Roles with Permission**: Admin
## Parameters
| Name | Required | Rules |
| :-----: | :------: | :---------------- |
| path | No | string, max:192 |
## Response
```json
{
dump: {
id: id,
path: "path",
created_at: "created_at",
updated_at: "updated_at",
deleted_at: "deleted_at",
link: "link"
}
}
```
## Example
```bash
curl -X PATCH -H "Authorization: Bearer {token}" https://api.animethemes.moe/dump/1
```
+450 -387
View File
File diff suppressed because it is too large. Load diff
+3 -3
View File
@@ -15,8 +15,8 @@
},
"license": "MIT",
"dependencies": {
"dotenv": "^16.0.1",
"vitepress": "^1.0.0-alpha.12",
"vue": "^3.2.37"
"dotenv": "^16.0.2",
"vitepress": "^1.0.0-alpha.15",
"vue": "^3.2.39"
}
}