summaryrefslogtreecommitdiff
path: root/src/services/db
diff options
context:
space:
mode:
authormrw1593 <botahamec@outlook.com>2023-05-29 15:56:27 -0400
committermrw1593 <botahamec@outlook.com>2023-05-29 15:56:27 -0400
commit436511846130ae5d8a058e031d9c8ad0bcb002aa (patch)
tree1ae1e35390e7555f45c2db8a011cfde38295d71f /src/services/db
parenta84c964b725ad2012cdf6a605ff264c60e0b0e59 (diff)
Create stubbed endpoints for authorization
Diffstat (limited to 'src/services/db')
-rw-r--r--src/services/db/client.rs19
1 files changed, 19 insertions, 0 deletions
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<bool, RawUnexpected> {
+ 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,