unifies Buy and Sell parameters

This commit is contained in:
2019-11-06 14:31:05 +01:00
parent ee0b7b2b7a
commit 1afbcff12a
2 changed files with 18 additions and 20 deletions

View File

@@ -1,7 +1,7 @@
use actix_cors::Cors;
use actix_files as fs;
use actix_web::{web, middleware, App, Error, HttpResponse, HttpServer, Either};
use futures::{Future, IntoFuture};
use futures::{Future};
use std::env;
use lootalot_db as db;
@@ -98,7 +98,7 @@ fn configure_app(config: &mut web::ServiceConfig) {
db_call(pool, Q::FetchLoot(*player))
}))
.route(web::put().to_async(
move |pool, (player, data): (PlayerId, web::Json<api::ItemListWithMods>)| {
move |pool, (player, data): (PlayerId, web::Json<api::BuySellParams>)| {
db_call(pool, Q::BuyItems(*player, data.into_inner()))
},
))
@@ -108,7 +108,7 @@ fn configure_app(config: &mut web::ServiceConfig) {
},
))
.route(web::delete().to_async(
move |pool, (player, data): (PlayerId, web::Json<api::SellParams>)| {
move |pool, (player, data): (PlayerId, web::Json<api::BuySellParams>)| {
db_call(pool, Q::SellItems(*player, data.into_inner()))
},
)),