user: get one by id

This commit is contained in:
Philippe Loctaux 2023-03-08 00:14:36 +01:00
parent 5404fb1cf8
commit e04de752ef
4 changed files with 111 additions and 0 deletions

View file

@ -42,4 +42,13 @@ impl User {
.await?,
)
}
pub async fn get_by_id(
conn: impl SqliteExecutor<'_>,
id: &UserID,
) -> Result<Option<Self>, Error> {
Ok(DatabaseUsers::get_one_by_id(conn, &id.0)
.await?
.map(Self::from))
}
}