This commit is contained in:
JMARyA 2024-05-06 08:24:23 +02:00
parent c6bcd9ca07
commit e50b51c829
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
6 changed files with 44 additions and 71 deletions

View file

@ -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");