marks
This commit is contained in:
parent
360675f6f9
commit
a67e3d1d8c
11 changed files with 109 additions and 46 deletions
|
|
@ -57,6 +57,8 @@ impl Games for HttpClient {
|
|||
slug,
|
||||
vndb,
|
||||
release_date,
|
||||
tags,
|
||||
genres,
|
||||
}| {
|
||||
(
|
||||
"/games".into(),
|
||||
|
|
@ -65,6 +67,8 @@ impl Games for HttpClient {
|
|||
description,
|
||||
thumbnail,
|
||||
author,
|
||||
tags,
|
||||
genres,
|
||||
slug,
|
||||
vndb,
|
||||
release_date,
|
||||
|
|
|
|||
|
|
@ -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::*;
|
||||
|
|
|
|||
|
|
@ -46,3 +46,13 @@ pub struct ListBadges {
|
|||
impl_req!(ListBadges => [reqs::list_badges::Ok; reqs::list_badges::Err]);
|
||||
status_code::direct!(reqs::list_badges::Ok => OK);
|
||||
status_code::map!(reqs::list_badges::Err => []);
|
||||
|
||||
const _: () = {
|
||||
use viendesu_core::errors::marks::*;
|
||||
use status_code::*;
|
||||
|
||||
direct!(NoSuchTag => NOT_FOUND);
|
||||
direct!(NoSuchGenre => NOT_FOUND);
|
||||
direct!(NoSuchBadge => NOT_FOUND);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -350,6 +350,8 @@ fn games<T: Types>(router: RouterScope<T>) -> RouterScope<T> {
|
|||
title,
|
||||
description,
|
||||
thumbnail,
|
||||
tags,
|
||||
genres,
|
||||
author,
|
||||
slug,
|
||||
vndb,
|
||||
|
|
@ -364,6 +366,8 @@ fn games<T: Types>(router: RouterScope<T>) -> RouterScope<T> {
|
|||
thumbnail,
|
||||
author,
|
||||
slug,
|
||||
tags,
|
||||
genres,
|
||||
vndb,
|
||||
release_date,
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue