some better names

This commit is contained in:
2019-11-06 14:47:47 +01:00
parent 1afbcff12a
commit 4925afbeb5

View File

@@ -35,7 +35,7 @@ fn db_call(
})
}
fn forbidden_to_players(id: i32, params: (AppPool, api::ApiActions)) -> MaybeForbidden {
fn restricted_to_group(id: i32, params: (AppPool, api::ApiActions)) -> MaybeForbidden {
if id != 0 {
Either::B(HttpResponse::Forbidden().finish())
} else {
@@ -44,7 +44,7 @@ fn forbidden_to_players(id: i32, params: (AppPool, api::ApiActions)) -> MaybeFor
}
fn configure_app(config: &mut web::ServiceConfig) {
fn configure_api(config: &mut web::ServiceConfig) {
use api::ApiActions as Q;
config.service(
web::scope("/api")
@@ -104,7 +104,7 @@ fn configure_app(config: &mut web::ServiceConfig) {
))
.route(web::post().to(
move |pool, (player, data): (PlayerId, web::Json<NewGroupLoot>)| {
forbidden_to_players(*player, (pool, Q::AddLoot(data.into_inner().items)))
restricted_to_group(*player, (pool, Q::AddLoot(data.into_inner().items)))
},
))
.route(web::delete().to_async(
@@ -139,7 +139,7 @@ pub fn serve() -> std::io::Result<()> {
HttpServer::new(move || {
App::new()
.data(pool.clone())
.configure(configure_app)
.configure(configure_api)
.wrap(
Cors::new()
.allowed_origin("http://localhost:8080")