1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use revolt_result::Result;

use crate::MongoDb;
use crate::User;

use super::AbstractUsers;

static COL: &str = "bots";

#[async_trait]
impl AbstractUsers for MongoDb {
    /// Fetch a user from the database
    async fn fetch_user(&self, id: &str) -> Result<User> {
        query!(self, find_one_by_id, COL, id)?.ok_or_else(|| create_error!(NotFound))
    }
}