Two teams try and fill in any horizontal, vertical, or diagonal line on a bingo board by playing maps on osu! osu.bingo
osu
at microservice 32 lines 884 B view raw
1use juniper::{FieldError, FieldResult, graphql_object}; 2 3use crate::{database::DataContext, schema::BingoGame}; 4 5pub struct Query; 6#[graphql_object(Context = DataContext)] 7impl Query { 8 /// Greets the user 9 fn hello() -> FieldResult<String> { 10 Ok(String::from("Hello!")) 11 } 12 13 /// Get a list of the most recently created games marked as public 14 async fn get_public_games(context: &DataContext) -> FieldResult<Vec<BingoGame>> { 15 context 16 .acquire() 17 .await 18 .get_public_games() 19 .await 20 .map_err(FieldError::from) 21 } 22 23 /// Get a game using it's id 24 async fn get_game_by_id(context: &DataContext, id: String) -> FieldResult<BingoGame> { 25 context 26 .acquire() 27 .await 28 .get_game_by_id(&id) 29 .await 30 .map_err(FieldError::from) 31 } 32}