impls wealth updating

This commit is contained in:
2019-07-02 15:07:03 +02:00
parent 9acedd4119
commit 36c8f24fdc
5 changed files with 57 additions and 17 deletions

View File

@@ -62,6 +62,13 @@ pub(crate) fn serve() -> std::io::Result<()> {
db_call(pool, move |api| api.fetch_players())
}),
)
.route(
"/update-wealth/{player_id}/{amount}",
web::get().to_async(move |pool: AppPool, data: web::Path<(i32, f32)>| {
let (player, gold) = *data;
db_call(pool, move |api| api.as_player(player).update_wealth(gold))
}),
)
.route(
"/loot/{player_id}",
web::get().to_async(move |pool: AppPool, player_id: web::Path<i32>| {