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 30 lines 801 B view raw
1use juniper::{FieldError, FieldResult, graphql_object}; 2use serde::{Deserialize, Serialize}; 3 4use crate::{database::DataContext, schema::MapInPool}; 5 6#[derive(sqlx::FromRow, Deserialize, Serialize)] 7pub struct Mappool { 8 id: String, 9 name: String, 10} 11 12#[graphql_object(description = "Represents multiple maps that come from a similar source (popular maps, random, tech maps, etc.)", Context = DataContext)] 13impl Mappool { 14 fn id(&self) -> &str { 15 self.id.as_ref() 16 } 17 18 fn name(&self) -> &str { 19 self.name.as_str() 20 } 21 22 pub async fn maps(&self, context: &DataContext) -> FieldResult<Vec<MapInPool>> { 23 context 24 .acquire() 25 .await 26 .get_maps_in_mappool(&self.id) 27 .await 28 .map_err(FieldError::from) 29 } 30}