variants
This commit is contained in:
parent
c6bcd9ca07
commit
e50b51c829
6 changed files with 44 additions and 71 deletions
|
@ -61,20 +61,6 @@ pub struct AddVariantForm {
|
|||
pub amount: usize,
|
||||
}
|
||||
|
||||
#[post("/item/{item_id}/variant")]
|
||||
pub async fn add_variant_route(
|
||||
r: HttpRequest,
|
||||
f: actix_web::web::Form<AddVariantForm>,
|
||||
) -> actix_web::Result<impl Responder> {
|
||||
let id = r.match_info().query("item_id");
|
||||
let itemdb = get_itemdb!(r);
|
||||
let item = itemdb
|
||||
.get_item(id)
|
||||
.ok_or_else(|| bad_req("The item does not exist"))?;
|
||||
item.add_variant(&f.variant, f.amount).await;
|
||||
Ok(HttpResponse::Ok())
|
||||
}
|
||||
|
||||
#[get("/item/{item_id}/variants")]
|
||||
pub async fn item_variants_page(r: HttpRequest) -> actix_web::Result<impl Responder> {
|
||||
let id = r.match_info().query("item_id");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue