api: add the rest of the fields to User

This commit is contained in:
Valentin Tolmer
2021-08-27 01:10:45 +02:00
committed by nitnelave
parent a1f40a32a5
commit 848cc86d73
6 changed files with 43 additions and 31 deletions

View File

@@ -145,6 +145,22 @@ impl<Handler: BackendHandler + Sync> User<Handler> {
&self.user.email
}
fn display_name(&self) -> Option<&String> {
self.user.display_name.as_ref()
}
fn first_name(&self) -> Option<&String> {
self.user.first_name.as_ref()
}
fn last_name(&self) -> Option<&String> {
self.user.last_name.as_ref()
}
fn creation_date(&self) -> chrono::NaiveDateTime {
self.user.creation_date
}
/// The groups to which this user belongs.
async fn groups(&self, context: &Context<Handler>) -> FieldResult<Vec<Group<Handler>>> {
Ok(context