aboutsummaryrefslogtreecommitdiff
path: root/src/db/models/emergency_access.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/db/models/emergency_access.rs')
-rw-r--r--src/db/models/emergency_access.rs29
1 files changed, 20 insertions, 9 deletions
diff --git a/src/db/models/emergency_access.rs b/src/db/models/emergency_access.rs
index b5e4eb86..ecfe86fe 100644
--- a/src/db/models/emergency_access.rs
+++ b/src/db/models/emergency_access.rs
@@ -238,15 +238,6 @@ impl EmergencyAccess {
}}
}
- pub async fn find_by_uuid(uuid: &str, conn: &mut DbConn) -> Option<Self> {
- db_run! { conn: {
- emergency_access::table
- .filter(emergency_access::uuid.eq(uuid))
- .first::<EmergencyAccessDb>(conn)
- .ok().from_db()
- }}
- }
-
pub async fn find_by_grantor_uuid_and_grantee_uuid_or_email(
grantor_uuid: &str,
grantee_uuid: &str,
@@ -281,6 +272,26 @@ impl EmergencyAccess {
}}
}
+ pub async fn find_by_uuid_and_grantee_uuid(uuid: &str, grantee_uuid: &str, conn: &mut DbConn) -> Option<Self> {
+ db_run! { conn: {
+ emergency_access::table
+ .filter(emergency_access::uuid.eq(uuid))
+ .filter(emergency_access::grantee_uuid.eq(grantee_uuid))
+ .first::<EmergencyAccessDb>(conn)
+ .ok().from_db()
+ }}
+ }
+
+ pub async fn find_by_uuid_and_grantee_email(uuid: &str, grantee_email: &str, conn: &mut DbConn) -> Option<Self> {
+ db_run! { conn: {
+ emergency_access::table
+ .filter(emergency_access::uuid.eq(uuid))
+ .filter(emergency_access::email.eq(grantee_email))
+ .first::<EmergencyAccessDb>(conn)
+ .ok().from_db()
+ }}
+ }
+
pub async fn find_all_by_grantee_uuid(grantee_uuid: &str, conn: &mut DbConn) -> Vec<Self> {
db_run! { conn: {
emergency_access::table