|
|
@ -1,4 +1,5 @@
|
|
|
|
use chrono::{NaiveDateTime, Utc};
|
|
|
|
use chrono::{NaiveDateTime, Utc};
|
|
|
|
|
|
|
|
use derive_more::{AsRef, Deref, Display, From};
|
|
|
|
use serde_json::Value;
|
|
|
|
use serde_json::Value;
|
|
|
|
|
|
|
|
|
|
|
|
use crate::{api::EmptyResult, db::DbConn, error::MapResult};
|
|
|
|
use crate::{api::EmptyResult, db::DbConn, error::MapResult};
|
|
|
@ -11,7 +12,7 @@ db_object! {
|
|
|
|
#[diesel(treat_none_as_null = true)]
|
|
|
|
#[diesel(treat_none_as_null = true)]
|
|
|
|
#[diesel(primary_key(uuid))]
|
|
|
|
#[diesel(primary_key(uuid))]
|
|
|
|
pub struct EmergencyAccess {
|
|
|
|
pub struct EmergencyAccess {
|
|
|
|
pub uuid: String,
|
|
|
|
pub uuid: EmergencyAccessId,
|
|
|
|
pub grantor_uuid: UserId,
|
|
|
|
pub grantor_uuid: UserId,
|
|
|
|
pub grantee_uuid: Option<UserId>,
|
|
|
|
pub grantee_uuid: Option<UserId>,
|
|
|
|
pub email: Option<String>,
|
|
|
|
pub email: Option<String>,
|
|
|
@ -33,7 +34,7 @@ impl EmergencyAccess {
|
|
|
|
let now = Utc::now().naive_utc();
|
|
|
|
let now = Utc::now().naive_utc();
|
|
|
|
|
|
|
|
|
|
|
|
Self {
|
|
|
|
Self {
|
|
|
|
uuid: crate::util::get_uuid(),
|
|
|
|
uuid: EmergencyAccessId(crate::util::get_uuid()),
|
|
|
|
grantor_uuid,
|
|
|
|
grantor_uuid,
|
|
|
|
grantee_uuid: None,
|
|
|
|
grantee_uuid: None,
|
|
|
|
email: Some(email),
|
|
|
|
email: Some(email),
|
|
|
@ -349,3 +350,8 @@ impl EmergencyAccess {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// endregion
|
|
|
|
// endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(
|
|
|
|
|
|
|
|
Clone, Debug, AsRef, Deref, DieselNewType, Display, From, FromForm, Hash, PartialEq, Eq, Serialize, Deserialize,
|
|
|
|
|
|
|
|
)]
|
|
|
|
|
|
|
|
pub struct EmergencyAccessId(String);
|
|
|
|