From 436511846130ae5d8a058e031d9c8ad0bcb002aa Mon Sep 17 00:00:00 2001 From: mrw1593 Date: Mon, 29 May 2023 15:56:27 -0400 Subject: Create stubbed endpoints for authorization --- src/services/db/client.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/services') diff --git a/src/services/db/client.rs b/src/services/db/client.rs index d1531be..4643f49 100644 --- a/src/services/db/client.rs +++ b/src/services/db/client.rs @@ -98,6 +98,25 @@ pub async fn get_client_redirect_uris<'c>( .collect() } +pub async fn client_has_redirect_uri<'c>( + executor: impl Executor<'c, Database = MySql>, + id: Uuid, + url: Url, +) -> Result { + query_scalar!( + r"SELECT EXISTS( + SELECT redirect_uri + FROM client_redirect_uris + WHERE client_id = ? AND redirect_uri = ? + ) as `e: bool`", + id, + url.to_string() + ) + .fetch_one(executor) + .await + .unexpect() +} + async fn delete_client_redirect_uris<'c>( executor: impl Executor<'c, Database = MySql>, id: Uuid, -- cgit v1.2.3