diff --git a/src/api.rs b/src/api.rs index fa79d5a..7ce89da 100644 --- a/src/api.rs +++ b/src/api.rs @@ -55,10 +55,11 @@ pub enum ApiError { /// Every allowed queries on the database pub enum ApiActions { + // Application level FetchPlayers, FetchInventory, FetchClaims, - // Player actions + // Player level FetchPlayer(i32), FetchNotifications(i32), FetchLoot(i32), @@ -67,14 +68,12 @@ pub enum ApiActions { SellItems(i32, SellParams), ClaimItem(i32, i32), UnclaimItem(i32, i32), - // Group actions + // Group level AddLoot(Vec), -} - -pub enum AdminActions { - AddPlayer(String, f64), + // Admin level + //AddPlayer(String, f64), //AddInventoryItem(pub String, pub i32), - ResolveClaims, + //ResolveClaims, //SetClaimsTimeout(pub i32), } @@ -83,7 +82,7 @@ pub fn execute( query: ApiActions, ) -> Result { let mut response = ApiResponse::default(); - // TODO: Return an Option that describes what happened. + // Return an Option that describes what happened. // If there is some value, store the actions in db so that it can be reversed. let action_text: Option<&str> = match query { ApiActions::FetchPlayers => { @@ -189,12 +188,12 @@ pub fn execute( } ApiActions::ClaimItem(id, item) => { response.push_update(Update::ClaimAdded(db::Claims(conn).add(id, item)?)); - response.notify(format!("Pour moi !")); + response.notify("Pour moi !".to_string()); None } ApiActions::UnclaimItem(id, item) => { response.push_update(Update::ClaimRemoved(db::Claims(conn).remove(id, item)?)); - response.notify(format!("Bof! Finalement non.")); + response.notify("Bof! Finalement non.".to_string()); None } // Group actions