db: Change the DB storage type to NaiveDateTime
The entire internals of the server now work using only NaiveDateTime, since we know they are all UTC. At the fringes (LDAP, GraphQL, JWT tokens) we convert back into UTC to make sure we have a clear API. This allows us to be compatible with Postgres (which doesn't support DateTime<UTC>, only NaiveDateTime). This change is backwards compatible since in SQlite with Sea-query/Sea-ORM, the UTC datetimes are stored without a timezone, as simple strings. It's the same format as NaiveDateTime. Fixes #87.
This commit is contained in:
committed by
nitnelave
parent
692bbb00f1
commit
e458aca3e3
@@ -11,7 +11,7 @@ pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub group_id: GroupId,
|
||||
pub display_name: String,
|
||||
pub creation_date: chrono::DateTime<chrono::Utc>,
|
||||
pub creation_date: chrono::NaiveDateTime,
|
||||
pub uuid: Uuid,
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub refresh_token_hash: i64,
|
||||
pub user_id: UserId,
|
||||
pub expiry_date: chrono::DateTime<chrono::Utc>,
|
||||
pub expiry_date: chrono::NaiveDateTime,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
|
||||
@@ -11,7 +11,7 @@ pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub jwt_hash: i64,
|
||||
pub user_id: UserId,
|
||||
pub expiry_date: chrono::DateTime<chrono::Utc>,
|
||||
pub expiry_date: chrono::NaiveDateTime,
|
||||
pub blacklisted: bool,
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ pub struct Model {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub token: String,
|
||||
pub user_id: UserId,
|
||||
pub expiry_date: chrono::DateTime<chrono::Utc>,
|
||||
pub expiry_date: chrono::NaiveDateTime,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
|
||||
@@ -18,7 +18,7 @@ pub struct Model {
|
||||
pub first_name: Option<String>,
|
||||
pub last_name: Option<String>,
|
||||
pub avatar: Option<JpegPhoto>,
|
||||
pub creation_date: chrono::DateTime<chrono::Utc>,
|
||||
pub creation_date: chrono::NaiveDateTime,
|
||||
pub password_hash: Option<Vec<u8>>,
|
||||
pub totp_secret: Option<String>,
|
||||
pub mfa_type: Option<String>,
|
||||
|
||||
Reference in New Issue
Block a user