users: store timezone, default is "UTC"

This commit is contained in:
Philippe Loctaux 2023-04-13 22:01:27 +02:00
parent 1168e1494c
commit e49c146dfd
14 changed files with 415 additions and 322 deletions

View file

@ -22,6 +22,7 @@ impl From<DatabaseUsers> for User {
password_recover: db.password_recover,
paper_key: db.paper_key,
is_archived: db.is_archived,
timezone: db.timezone,
}
}
}
@ -179,4 +180,14 @@ impl User {
Ok(())
}
pub async fn set_timezone(
&self,
conn: impl SqliteExecutor<'_>,
timezone: &str,
) -> Result<(), Error> {
DatabaseUsers::set_timezone(conn, self.id.as_ref(), timezone).await?;
Ok(())
}
}

View file

@ -19,6 +19,7 @@ pub struct User {
password_recover: Option<String>,
paper_key: Option<String>,
is_archived: bool,
timezone: String,
}
impl User {
@ -43,4 +44,7 @@ impl User {
pub fn is_admin(&self) -> bool {
self.is_admin
}
pub fn timezone(&self) -> &str {
&self.timezone
}
}