diff options
Diffstat (limited to 'src/db/models/organization.rs')
-rw-r--r-- | src/db/models/organization.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/db/models/organization.rs b/src/db/models/organization.rs index 2d4d084b..ec390262 100644 --- a/src/db/models/organization.rs +++ b/src/db/models/organization.rs @@ -737,6 +737,19 @@ impl UserOrganization { }} } + pub async fn find_confirmed_by_user_and_org(user_uuid: &str, org_uuid: &str, conn: &mut DbConn) -> Option<Self> { + db_run! { conn: { + users_organizations::table + .filter(users_organizations::user_uuid.eq(user_uuid)) + .filter(users_organizations::org_uuid.eq(org_uuid)) + .filter( + users_organizations::status.eq(UserOrgStatus::Confirmed as i32) + ) + .first::<UserOrganizationDb>(conn) + .ok().from_db() + }} + } + pub async fn find_by_user(user_uuid: &str, conn: &mut DbConn) -> Vec<Self> { db_run! { conn: { users_organizations::table |