feat: add features and featured themes & bump to vitepress beta (#87)

This commit is contained in:
paranarimasu
2023-05-22 22:54:26 -05:00
committed by Maniload
parent f8ffd59973
commit 1ab14ab8b2
20 changed files with 749 additions and 100 deletions
+28 -10
View File
@@ -48,7 +48,9 @@ export default {
items: [
{ text: 'Index', link: '/admin/' },
{ text: 'Announcement', link: '/admin/announcement/' },
{ text: 'Dump', link: '/admin/dump/' }
{ text: 'Dump', link: '/admin/dump/' },
{ text: 'Feature', link: '/admin/feature/' },
{ text: 'Featured Theme', link: '/admin/featuredtheme/' }
],
},
{
@@ -73,7 +75,6 @@ export default {
text: 'Config',
items: [
{ text: 'Index', link: '/config/' },
{ text: 'Flags', link: '/config/flags/' },
{ text: 'Wiki', link: '/config/wiki/' }
]
},
@@ -160,6 +161,31 @@ export default {
{ text: 'Store', link: '/admin/dump/store/' },
{ text: 'Update', link: '/admin/dump/update/' }
]
},
{
text: 'Feature',
collapsed: true,
items: [
{ text: 'Resource', link: '/admin/feature/' },
{ text: 'Index', link: '/admin/feature/index/' },
{ text: 'Show', link: '/admin/feature/show/' },
{ text: 'Update', link: '/admin/feature/update/' }
]
},
{
text: 'Featured Theme',
collapsed: true,
items: [
{ text: 'Resource', link: '/admin/featuredtheme/' },
{ text: 'Current', link: '/admin/featuredtheme/current/' },
{ text: 'Destroy', link: '/admin/featuredtheme/destroy/' },
{ text: 'Force Delete', link: '/admin/featuredtheme/forceDelete/' },
{ text: 'Index', link: '/admin/featuredtheme/index/' },
{ text: 'Restore', link: '/admin/featuredtheme/restore/' },
{ text: 'Show', link: '/admin/featuredtheme/show/' },
{ text: 'Store', link: '/admin/featuredtheme/store/' },
{ text: 'Update', link: '/admin/featuredtheme/update/' }
]
}
],
'/auth/': [
@@ -225,14 +251,6 @@ export default {
}
],
'/config/': [
{
text: 'Feature Flags',
collapsed: true,
items: [
{ text: 'Resource', link: '/config/flags/' },
{ text: 'Show', link: '/config/flags/show/' }
]
},
{
text: 'Wiki Config',
collapsed: true,
+39
View File
@@ -0,0 +1,39 @@
---
title: Feature
---
# Feature
---
A feature API resource represents a feature flag that enable/disable site functionalities.
For example, the 'allow_discord_notifications' feature enables/disables discord notifications for the configured bot.
## Fields
| Name | Type | Nullable | Default | Description |
| :--------: | :-----: | :------: | :-----: | :--------------------------------------------|
| id | Integer | No | Yes | The primary key of the resource |
| name | String | No | Yes | The title of the resource |
| value | String | No | Yes | The value of the resource |
| created_at | Date | No | No | The date that the resource was created |
| updated_at | Date | No | No | The date that the resource was last modified |
## Allowed Include Paths
None
## Endpoints
**[Feature Index](/admin/feature/index/)**
The feature index endpoint displays a listing of feature resources.
**[Feature Show](/admin/feature/show/)**
The feature show endpoint returns a feature resource.
**[Feature Update](/admin/feature/update/)**
The feature update endpoint updates a feature and returns the updated feature resource.
+84
View File
@@ -0,0 +1,84 @@
---
title: Feature Index
---
# Feature Index Endpoint
The feature index endpoint returns a listing of feature resources.
## URL
```sh
GET /feature/
```
## Authentication
None
## Parameters
| Name | Required | Description |
| :----------: | :------: | :-------------------------------------------------------------- |
| fields | No | Sparse fieldsets for resource types |
| filter | No | Filters for feature resources |
| page[number] | No | The page of feature resources to display |
| page[size] | No | The number of feature resources to display for the current page |
| sort | No | The list of fields to sort the feature resources |
## Allowed Sort Fields
| Name | Description |
| :--------: | :------------------------------------------------------------------ |
| id | Sort resources on the primary key |
| name | Sort resources on the title of the resource |
| value | Sort resources on the value of the resource |
| created_at | Sort resources on the resource creation date |
| updated_at | Sort resources on the resource last modified date |
| random | Sort resources randomly. Ignored if other sort fields are provided. |
## Filters
| Name | Description |
| :--------: | :-------------------------------------------------- |
| id | Filter resources on the primary key |
| name | Filter resources on the title of the resource |
| value | Filter resources on the value of the resource |
| created_at | Filter resources on the resource creation date |
| updated_at | Filter resources on the resource last modified date |
## Response
```json
{
features: [
{
id: id,
name: "name",
value: "value",
created_at: "created_at",
updated_at: "updated_at"
},
...
],
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/feature/
```
+43
View File
@@ -0,0 +1,43 @@
---
title: Feature Show
---
# Feature Show Endpoint
The feature show endpoint returns a feature resource.
## URL
```sh
GET /feature/{id}
```
## Authentication
None
## Parameters
| Name | Required | Description |
| :-----: | :------: | :------------------------------------------------------ |
| fields | No | Sparse fieldsets for resource types |
## Response
```json
{
feature: {
id: id,
name: "name",
value: "value",
created_at: "created_at",
updated_at: "updated_at"
}
}
```
## Example
```bash
curl https://api.animethemes.moe/feature/1
```
+47
View File
@@ -0,0 +1,47 @@
---
title: Feature Update
---
# Feature Update Endpoint
The feature update endpoint updates a feature and returns the updated feature resource.
For example, the `/feature/1?value=false` endpoint will update the feature path attribute and return the updated feature resource.
## URL
```sh
PUT|PATCH /feature/{id}
```
## Authentication
**Required Permission**: update feature
**Roles with Permission**: Admin
## Parameters
| Name | Required | Rules |
| :-----: | :------: | :---------------- |
| value | No | string, max:192 |
## Response
```json
{
feature: {
id: id,
name: "name",
value: "value",
created_at: "created_at",
updated_at: "updated_at"
}
}
```
## Example
```bash
curl -X PATCH -H "Authorization: Bearer {token}" https://api.animethemes.moe/feature/1
```
+47
View File
@@ -0,0 +1,47 @@
---
title: Current Featured Theme Show
---
# Current Featured Theme Show Endpoint
The current featured theme show endpoint returns the first featured theme where the current date is between start_at and end_at dates.
## URL
```sh
GET /current/featuredtheme/
```
## Authentication
None
## Parameters
| Name | Required | Description |
| :-----: | :------: | :------------------------------------------------------ |
| fields | No | Sparse fieldsets for resource types |
| filter | No | Filters to constrain the inclusion of related resources |
| include | No | Inclusion of related resources |
| sort | No | Sort related resources |
## Response
```json
{
featuredtheme: {
id: id,
start_at: "start_at",
end_at: "end_at",
created_at: "created_at",
updated_at: "updated_at",
deleted_at: "deleted_at"
}
}
```
## Example
```bash
curl https://api.animethemes.moe/current/featuredtheme/
```
+48
View File
@@ -0,0 +1,48 @@
---
title: Featured Theme Destroy
---
# Featured Theme Destroy Endpoint
The featured theme destroy endpoint soft deletes a featured theme and returns the deleted featured theme resource.
For example, the `/featuredtheme/1` endpoint will soft delete the featured theme of id '1' and return the deleted featured theme resource.
## URL
```sh
DELETE /featuredtheme/{id}
```
## Authentication
**Required Permission**: delete featured theme
**Roles with Permission**: Admin
**Other Requirements**: Featured Theme must not be soft deleted
## Parameters
None
## Response
```json
{
featuredtheme: {
id: id,
start_at: "start_at",
end_at: "end_at",
created_at: "created_at",
updated_at: "updated_at",
deleted_at: "deleted_at"
}
}
```
## Example
```bash
curl -X DELETE -H "Authorization: Bearer {token}" https://api.animethemes.moe/featuredtheme/1
```
@@ -0,0 +1,39 @@
---
title: Featured Theme Force Delete
---
# Featured Theme Force Delete Endpoint
The featured theme force delete endpoint hard deletes a featured theme and returns a confirmation message.
For example, the `/forceDelete/featuredtheme/1` endpoint will hard delete the featured theme of id '1' and return a confirmation message.
## URL
```sh
DELETE /forceDelete/featuredtheme/{id}
```
## Authentication
**Required Permission**: force delete featured theme
**Roles with Permission**: Admin
## Parameters
None
## Response
```json
{
message: "The Featured Theme '1' was deleted.",
}
```
## Example
```bash
curl -X DELETE -H "Authorization: Bearer {token}" https://api.animethemes.moe/forceDelete/featuredtheme/1
```
+65
View File
@@ -0,0 +1,65 @@
---
title: Featured Theme
---
# Featured Theme
---
A featured theme API resource represents a video to be featured on the homepage of the site for a specified amount of time.
## Fields
| Name | Type | Nullable | Default | Description |
| :--------: | :-----: | :------: | :-----: | :--------------------------------------------|
| id | Integer | No | Yes | The primary key of the resource |
| start_at | Date | No | Yes | The start date of the resource |
| end_at | Date | No | Yes | The end date of the resource |
| created_at | Date | No | No | The date that the resource was created |
| updated_at | Date | No | No | The date that the resource was last modified |
| deleted_at | Date | Yes | No | The date that the resource was deleted |
## Allowed Include Paths
* animethemeentry
* animethemeentry.animetheme
* animethemeentry.animetheme.anime
* animethemeentry.animetheme.anime.images
* animethemeentry.animetheme.song
* animethemeentry.animetheme.song.artists
* user
* video
## Endpoints
**[Current Featured Theme Show](/admin/featuredtheme/current/)**
The current featured theme show endpoint returns the first featured theme where the current date is between start_at and end_at dates.
**[Featured Theme Destroy](/admin/featuredtheme/destroy/)**
The featured theme destroy endpoint soft deletes a featured theme and returns the deleted featured theme resource.
**[Featured Theme Force Delete](/admin/featuredtheme/forceDelete/)**
The featured theme force delete endpoint hard deletes a featured theme and returns a confirmation message.
**[Featured Theme Index](/admin/featuredtheme/index/)**
The featured theme index endpoint displays a listing of featured theme resources.
**[Featured Theme Restore](/admin/featuredtheme/restore/)**
The featured theme restore endpoint restores a soft deleted featured theme and returns the restored featured theme resource.
**[Featured Theme Show](/admin/featuredtheme/show/)**
The featured theme show endpoint returns a featured theme resource.
**[Featured Theme Store](/admin/featuredtheme/store/)**
The featured theme store endpoint creates a new featured theme and returns the new featured theme resource.
**[Featured Theme Update](/admin/featuredtheme/update/)**
The featured theme update endpoint updates a featured theme and returns the updated featured theme resource.
+88
View File
@@ -0,0 +1,88 @@
---
title: Featured Theme Index
---
# Featured Theme Index Endpoint
The featured theme index endpoint returns a listing of featured theme resources whose start date is on or before the current date.
## URL
```sh
GET /featuredtheme/
```
## Authentication
None
## Parameters
| Name | Required | Description |
| :----------: | :------: | :--------------------------------------------------------------------- |
| fields | No | Sparse fieldsets for resource types |
| filter | No | Filters for featured theme resources |
| page[number] | No | The page of featured theme resources to display |
| page[size] | No | The number of featured theme resources to display for the current page |
| sort | No | The list of fields to sort the featured theme resources |
## Allowed Sort Fields
| Name | Description |
| :--------: | :------------------------------------------------------------------ |
| id | Sort resources on the primary key |
| start_at | Sort resources on the resource start date |
| end_at | Sort resources on the resource end date |
| 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 |
| start_at | Filter resources on the resource start date |
| end_at | Filter resources on the resource end date |
| 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
{
featuredthemes: [
{
id: id,
start_at: "start_at",
end_at: "end_at",
created_at: "created_at",
updated_at: "updated_at",
deleted_at: "deleted_at"
},
...
],
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/featuredtheme/
```
+48
View File
@@ -0,0 +1,48 @@
---
title: Featured Theme Restore
---
# Featured Theme Restore Endpoint
The featured theme restore endpoint restores a soft deleted featured theme and returns the restored featured theme resource.
For example, the `/restore/featuredtheme/1` endpoint will restore the soft deleted featured theme of id '1' and return the restored featured theme resource.
## URL
```sh
PATCH /restore/featuredtheme/{id}
```
## Authentication
**Required Permission**: restore featured theme
**Roles with Permission**: Admin
**Other Requirements**: Featured Theme must be soft deleted
## Parameters
None
## Response
```json
{
featuredtheme: {
id: id,
start_at: "start_at",
end_at: "end_at",
created_at: "created_at",
updated_at: "updated_at",
deleted_at: "deleted_at"
}
}
```
## Example
```bash
curl -X PATCH -H "Authorization: Bearer {token}" https://api.animethemes.moe/restore/featuredtheme/1
```
+47
View File
@@ -0,0 +1,47 @@
---
title: Featured Theme Show
---
# Featured Theme Show Endpoint
The featured theme show endpoint returns a featured theme resource.
## URL
```sh
GET /featuredtheme/{id}
```
## Authentication
**Other Requirements**: The start_at date must be on or before the current date
## Parameters
| Name | Required | Description |
| :-----: | :------: | :------------------------------------------------------ |
| fields | No | Sparse fieldsets for resource types |
| filter | No | Filters to constrain the inclusion of related resources |
| include | No | Inclusion of related resources |
| sort | No | Sort related resources |
## Response
```json
{
featuredtheme: {
id: id,
start_at: "start_at",
end_at: "end_at",
created_at: "created_at",
updated_at: "updated_at",
deleted_at: "deleted_at"
}
}
```
## Example
```bash
curl https://api.animethemes.moe/featuredtheme/1
```
+52
View File
@@ -0,0 +1,52 @@
---
title: Featured Theme Store
---
# Featured Theme Store Endpoint
The featured theme store endpoint creates a new featured theme and returns the new featured theme resource.
For example, the `/featuredtheme?start_at=2023-01-01&end_at=2023-01-07` endpoint will create a new featured theme and return the new featured theme resource.
## URL
```sh
POST /featuredtheme
```
## Authentication
**Required Permission**: create featured theme
**Roles with Permission**: Admin
## Parameters
| Name | Required | Rules |
| :------: | :------: | :--------------------------------------------------------------------------------- |
| start_at | Yes | date_format:Y-m-d\TH:i:s.u, before:end_at |
| end_at | Yes | date_format:Y-m-d\TH:i:s.u, after:start_at |
| entry_id | No | integer, Entry ID Exists, Anime Theme Entry Video Exists when video_id is provided |
| user_id | No | integer, User ID Exists |
| video_id | No | integer, Video ID Exists, Anime Theme Entry Video Exists when entry_id is provided |
## Response
```json
{
featuredtheme: {
id: id,
start_at: "start_at",
end_at: "end_at",
created_at: "created_at",
updated_at: "updated_at",
deleted_at: "deleted_at"
}
}
```
## Example
```bash
curl -X POST -H "Authorization: Bearer {token}" https://api.animethemes.moe/featuredtheme/
```
+54
View File
@@ -0,0 +1,54 @@
---
title: Featured Theme Update
---
# Featured Theme Update Endpoint
The featured theme update endpoint updates a featured theme and returns the updated featured theme resource.
For example, the `/featuredtheme/1?start_at=2023-01-01` endpoint will update the featured theme start_at attribute and return the updated featured theme resource.
## URL
```sh
PUT|PATCH /featuredtheme/{id}
```
## Authentication
**Required Permission**: update featured theme
**Roles with Permission**: Admin
**Other Requirements**: Featured Theme must not be soft deleted
## Parameters
| Name | Required | Rules |
| :------: | :------: | :--------------------------------------------------------------------------------- |
| start_at | No | date_format:Y-m-d\TH:i:s.u, before:end_at |
| end_at | No | date_format:Y-m-d\TH:i:s.u, after:start_at |
| entry_id | No | integer, Entry ID Exists, Anime Theme Entry Video Exists when video_id is provided |
| user_id | No | integer, User ID Exists |
| video_id | No | integer, Video ID Exists, Anime Theme Entry Video Exists when entry_id is provided |
## Response
```json
{
featuredtheme: {
id: id,
start_at: "start_at",
end_at: "end_at",
created_at: "created_at",
updated_at: "updated_at",
deleted_at: "deleted_at"
}
}
```
## Example
```bash
curl -X PATCH -H "Authorization: Bearer {token}" https://api.animethemes.moe/featuredtheme/1
```
+9 -1
View File
@@ -16,4 +16,12 @@ An announcement API resource represents a site-wide message to be broadcasted on
**[Dump](/admin/dump/)**
A dump API resource represents a database dump of selected tables at a given point in time.
A dump API resource represents a database dump of selected tables at a given point in time.
**[Feature](/admin/feature/)**
A feature API resource represents a feature flag that enable/disable site functionalities.
**[Featured Theme](/admin/featuredtheme/)**
A featured theme API resource represents a video to be featured on the homepage of the site for a specified amount of time.
-30
View File
@@ -1,30 +0,0 @@
---
title: Flags
---
# Flags
---
The config flags API resource contains the list of feature flags that enable/disable site functionalities.
## Fields
| Name | Type | Nullable | Default | Description |
| :-------------------------: | :-----: | :------: | :-----: | :---------------------------------------------------------- |
| allow_video_streams | Boolean | No | Yes | Enable/Disable video streaming |
| allow_audio_streams | Boolean | No | Yes | Enable/Disable audio streaming |
| allow_discord_notifications | Boolean | No | Yes | Enable/Disable discord notifications for the configured bot |
| allow_view_recording | Boolean | No | Yes | Enable/Disable the recording of views for view counts |
| allow_dump_downloading | Boolean | No | Yes | Enable/Disable database dump downloading |
| allow_script_downloading | Boolean | No | Yes | Enable/Disable encoding script downloading |
## Allowed Include Paths
None
### Endpoints
**[Flags Show](/config/flags/show/)**
The Flags Show endpoint return the flags resource.
-44
View File
@@ -1,44 +0,0 @@
---
title: Flags Show
---
# Flags Show Endpoint
The flags show endpoint returns the flags resource.
## URL
```sh
GET /config/flags
```
## Authentication
None
## Parameters
| Name | Required | Description |
| :-----: | :------: | :------------------------------------------------------ |
| fields | No | Sparse fieldsets for resource types |
## Response
```json
{
flags: {
allow_video_streams: allow_video_streams,
allow_audio_streams: allow_audio_streams,
allow_discord_notifications: allow_discord_notifications,
allow_view_recording: allow_view_recording,
allow_dump_downloading: allow_dump_downloading,
allow_script_downloading: allow_script_downloading
}
}
```
## Example
```bash
curl https://api.animethemes.moe/config/flags
```
-4
View File
@@ -10,10 +10,6 @@ Config API resources pertain to site configuration.
## Resources
**[Flags](/config/flags/)**
The config flags API resource contains the list of feature flags that enable/disable site functionalities.
**[Wiki](/config/wiki/)**
The config wiki API resource contains the list of settings that impact animethemes-web functionalities.