users: store timezone, default is "UTC"
This commit is contained in:
parent
1168e1494c
commit
e49c146dfd
14 changed files with 415 additions and 322 deletions
|
|
@ -16,6 +16,7 @@ pub struct Users {
|
|||
pub password_recover: Option<String>,
|
||||
pub paper_key: Option<String>,
|
||||
pub is_archived: bool,
|
||||
pub timezone: String,
|
||||
}
|
||||
|
||||
impl Users {
|
||||
|
|
@ -163,4 +164,18 @@ impl Users {
|
|||
|
||||
Ok((query.rows_affected() == 1).then_some(()))
|
||||
}
|
||||
|
||||
pub async fn set_timezone(
|
||||
conn: impl SqliteExecutor<'_>,
|
||||
id: &str,
|
||||
timezone: &str,
|
||||
) -> Result<Option<()>, Error> {
|
||||
let query: SqliteQueryResult =
|
||||
sqlx::query_file!("queries/users/set_timezone.sql", timezone, id)
|
||||
.execute(conn)
|
||||
.await
|
||||
.map_err(handle_error)?;
|
||||
|
||||
Ok((query.rows_affected() == 1).then_some(()))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue