admin: added list of users
This commit is contained in:
parent
e3bda01eca
commit
5153d057b0
13 changed files with 313 additions and 3 deletions
|
|
@ -8,5 +8,6 @@ database = { path = "../database" }
|
|||
hash = { path = "../hash" }
|
||||
id = { path = "../id" }
|
||||
thiserror = { workspace = true }
|
||||
chrono = { workspace = true }
|
||||
chrono = { workspace = true, features = ["serde"] }
|
||||
email_address = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
|
|
|
|||
|
|
@ -108,6 +108,14 @@ impl User {
|
|||
.map(Self::from))
|
||||
}
|
||||
|
||||
pub async fn get_all(conn: impl SqliteExecutor<'_>) -> Result<Vec<Self>, Error> {
|
||||
Ok(DatabaseUsers::get_all(conn)
|
||||
.await?
|
||||
.into_iter()
|
||||
.map(Self::from)
|
||||
.collect::<Vec<_>>())
|
||||
}
|
||||
|
||||
pub async fn set_username(
|
||||
&self,
|
||||
conn: impl SqliteExecutor<'_>,
|
||||
|
|
|
|||
|
|
@ -3,10 +3,11 @@ mod error;
|
|||
|
||||
use chrono::{DateTime, Utc};
|
||||
use id::UserID;
|
||||
use serde::Serialize;
|
||||
|
||||
pub use crate::error::Error;
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Serialize, Debug, Clone)]
|
||||
pub struct User {
|
||||
id: UserID,
|
||||
created_at: DateTime<Utc>,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue