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