marks
This commit is contained in:
parent
360675f6f9
commit
a67e3d1d8c
11 changed files with 109 additions and 46 deletions
|
|
@ -5,7 +5,7 @@ use crate::requests::status_code;
|
|||
use viendesu_core::{
|
||||
errors,
|
||||
requests::games as reqs,
|
||||
types::{Patch, author, file, game},
|
||||
types::{Patch, author, file, game, mark},
|
||||
};
|
||||
|
||||
#[data]
|
||||
|
|
@ -15,9 +15,9 @@ pub struct Update {
|
|||
pub description: Patch<Option<game::Description>>,
|
||||
pub slug: Patch<game::Slug>,
|
||||
pub thumbnail: Patch<Option<file::Id>>,
|
||||
pub genres: Patch<game::Genres>,
|
||||
pub badges: Patch<game::Badges>,
|
||||
pub tags: Patch<game::Tags>,
|
||||
pub genres: Patch<mark::Genres>,
|
||||
pub badges: Patch<mark::Badges>,
|
||||
pub tags: Patch<mark::Tags>,
|
||||
pub screenshots: Patch<game::Screenshots>,
|
||||
pub published: Patch<bool>,
|
||||
}
|
||||
|
|
@ -25,7 +25,7 @@ pub struct Update {
|
|||
impl_req!(Update => [reqs::update::Ok; reqs::update::Err]);
|
||||
|
||||
status_code::direct!(reqs::update::Ok => OK);
|
||||
status_code::map!(reqs::update::Err => [NotFound]);
|
||||
status_code::map!(reqs::update::Err => [NotFound, NoSuchBadge, NoSuchGenre, NoSuchTag]);
|
||||
|
||||
#[data]
|
||||
pub struct Search {
|
||||
|
|
@ -62,6 +62,10 @@ pub struct Create {
|
|||
pub thumbnail: Option<file::Id>,
|
||||
pub author: author::Id,
|
||||
pub slug: Option<game::Slug>,
|
||||
#[serde(default)]
|
||||
pub tags: mark::Tags,
|
||||
#[serde(default)]
|
||||
pub genres: mark::Genres,
|
||||
pub vndb: Option<game::VndbId>,
|
||||
pub release_date: Option<game::ReleaseDate>,
|
||||
}
|
||||
|
|
@ -69,7 +73,7 @@ pub struct Create {
|
|||
impl_req!(Create => [reqs::create::Ok; reqs::create::Err]);
|
||||
|
||||
status_code::direct!(reqs::create::Ok => CREATED);
|
||||
status_code::map!(reqs::create::Err => [AlreadyTaken, NoSuchAuthor]);
|
||||
status_code::map!(reqs::create::Err => [AlreadyTaken, NoSuchAuthor, NoSuchGenre, NoSuchTag]);
|
||||
|
||||
const _: () = {
|
||||
use errors::games::*;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue