async fn find_one_user(
        &self,
        context: &async_graphql::Context<'_>,
        id: Option<String>,
        username: Option<String>,
    ) -> Result<Option<User>> {
        let (db, _) = Context::parse(context)?;

        let mut filter = doc! {};
        if let Some(id) = id {
            filter.insert("_id", ObjectId::from_str(&id)?);
        }
        if let Some(username) = username {
            filter.insert("localuname", localize_username(&username));
        }

        let result = User::collection(&db).find_one(filter, None).await?;

        Ok(result)
    }
/// Tries to find a user with a matching ID or username
Tries to find a user with a matching ID or username
Tries to find a user with a matching ID or username
async fn find_one_user(
        &self,
        context: &async_graphql::Context<'_>,
        id: Option<String>,
        username: Option<String>,
    ) -> Result<Option<User>> {
        let (db, _) = Context::parse(context)?;
        let mut filter = doc! {};
        if let Some(id) = id {
            filter.insert("_id", ObjectId::from_str(&id)?);
        }
        if let Some(username) = username {
            filter.insert("localuname", localize_username(&username));
        }
        let result = User::collection(&db).find_one(filter, None).await?;
        Ok(result)
    }
async fn find_one_user ( & self , context : & async_graphql :: Context < ' _ > , id : Option < String > , username : Option < String > , ) -> Result < Option < User > > { let ( db , _ ) = Context :: parse ( context ) ? ; let mut filter = doc ! { } ; if let Some ( id ) = id { filter . insert ( " " , ObjectId :: from_str ( & id ) ? ) ; } if let Some ( username ) = username { filter . insert ( " " , localize_username ( & username ) ) ; } let result = User :: collection ( & db ) . find_one ( filter , None ) . await ? ; Ok ( result ) }
Tries to find a user with a matching ID or username
Tries to find a user with a matching ID or username
&self
context
&async_graphql::Context<'_>
id
Option<String>
username
Option<String>
&self
context
&async_graphql::Context<'_>
id
Option<String>
username
Option<String>