writes down some ideas
This commit is contained in:
17
src/api.rs
17
src/api.rs
@@ -30,7 +30,24 @@ mod player {
|
||||
}
|
||||
}
|
||||
|
||||
// struct DbApi<'q>(&'q DbConnection);
|
||||
// ::new() -> DbApi<'q> (Db finds a connection by itself, usefull for cli)
|
||||
// ::with_conn(conn) -> DbApi<'q> (uses a user-defined connection)
|
||||
// .fetch_players()
|
||||
// .with_player(player_id) -> AsPlayer<'q>
|
||||
// .loot() -> List of items owned (Vec<Item>)
|
||||
// .claim(item_id) -> Success status (bool)
|
||||
// .unclaim(item_id) -> Success status (bool)
|
||||
// .sell(item_id) -> Success status (bool, earned)
|
||||
|
||||
// fn db_call(f: fn(DbApi) -> ApiResponse) { ... }
|
||||
// ApiResponse needs to be Serialize
|
||||
|
||||
// endpoint example
|
||||
// fn endpoint_name(params...) -> impl ... {
|
||||
// let param_1 = { ... };
|
||||
// db_call(move |api| api.with_player(param_1).loot())
|
||||
// }
|
||||
|
||||
pub fn players_list(
|
||||
pool: web::Data<Pool>
|
||||
|
||||
Reference in New Issue
Block a user