From 94b90470d5fd1de0fab6004ed74457de5c21e645 Mon Sep 17 00:00:00 2001 From: alyssa Date: Mon, 9 Jun 2025 20:14:38 +0000 Subject: [PATCH] fix(api): forgot about discord id lookup --- crates/api/src/middleware/params.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/crates/api/src/middleware/params.rs b/crates/api/src/middleware/params.rs index ce4850bc..42a41122 100644 --- a/crates/api/src/middleware/params.rs +++ b/crates/api/src/middleware/params.rs @@ -87,15 +87,22 @@ pub async fn params(State(ctx): State, mut req: Request, next: Next) } } id => { + println!("a {id}"); match match Uuid::parse_str(id) { Ok(uuid) => sqlx::query_as::( "select * from systems where uuid = $1", ) .bind(uuid), - Err(_) => sqlx::query_as::( - "select * from systems where hid = $1", - ) - .bind(parse_hid(id)), + Err(_) => match id.parse::() { + Ok(parsed) => sqlx::query_as::( + "select * from systems where id = (select system from accounts where uid = $1)" + ) + .bind(parsed), + Err(_) => sqlx::query_as::( + "select * from systems where hid = $1", + ) + .bind(parse_hid(id)) + }, } .fetch_optional(&ctx.db) .await