diff options
author | Mathijs van Veluw <[email protected]> | 2024-12-14 00:55:34 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2024-12-14 00:55:34 +0100 |
commit | 9cd400db6c5da858a4f49eb883469cbd6cb7337d (patch) | |
tree | 1c1d1900c1e1ba20da64e4c2052285b2d81317e8 /src/db/models/auth_request.rs | |
parent | fd512300448995735961cbeedcbe4b684be1c5fd (diff) | |
download | vaultwarden-9cd400db6c5da858a4f49eb883469cbd6cb7337d.tar.gz vaultwarden-9cd400db6c5da858a4f49eb883469cbd6cb7337d.zip |
Some refactoring and optimizations (#5291)
- Refactored several code to use more modern syntax
- Made some checks a bit more strict
- Updated crates
Signed-off-by: BlackDex <[email protected]>
Diffstat (limited to 'src/db/models/auth_request.rs')
-rw-r--r-- | src/db/models/auth_request.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/db/models/auth_request.rs b/src/db/models/auth_request.rs index 9388c71a..3aca20cb 100644 --- a/src/db/models/auth_request.rs +++ b/src/db/models/auth_request.rs @@ -111,6 +111,17 @@ impl AuthRequest { }} } + pub async fn find_by_uuid_and_user(uuid: &str, user_uuid: &str, conn: &mut DbConn) -> Option<Self> { + db_run! {conn: { + auth_requests::table + .filter(auth_requests::uuid.eq(uuid)) + .filter(auth_requests::user_uuid.eq(user_uuid)) + .first::<AuthRequestDb>(conn) + .ok() + .from_db() + }} + } + pub async fn find_by_user(user_uuid: &str, conn: &mut DbConn) -> Vec<Self> { db_run! {conn: { auth_requests::table |