makes adding loot working
This commit is contained in:
@@ -3,6 +3,7 @@ use actix_files as fs;
|
||||
use actix_web::{web, App, Error, HttpResponse, HttpServer};
|
||||
use futures::Future;
|
||||
use lootalot_db::{DbApi, Pool, QueryResult};
|
||||
use lootalot_db::models::Item;
|
||||
use std::env;
|
||||
use serde::{Serialize, Deserialize};
|
||||
|
||||
@@ -162,6 +163,17 @@ pub(crate) fn serve() -> std::io::Result<()> {
|
||||
db_call(pool, move |api| api.as_admin().resolve_claims())
|
||||
}),
|
||||
)
|
||||
.route(
|
||||
"/add-loot",
|
||||
web::post().to_async(
|
||||
move |pool: AppPool, data: web::Json<Vec<Item>>| {
|
||||
db_call(pool, move |api| api
|
||||
.as_admin()
|
||||
.add_loot(data.to_vec()),
|
||||
)
|
||||
}
|
||||
)
|
||||
)
|
||||
.route(
|
||||
"/add-player",
|
||||
web::get().to_async(
|
||||
|
||||
Reference in New Issue
Block a user