mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
fix(api): forgot about discord id lookup
This commit is contained in:
parent
bea41ab8a0
commit
94b90470d5
1 changed files with 11 additions and 4 deletions
|
|
@ -87,15 +87,22 @@ pub async fn params(State(ctx): State<ApiContext>, mut req: Request, next: Next)
|
|||
}
|
||||
}
|
||||
id => {
|
||||
println!("a {id}");
|
||||
match match Uuid::parse_str(id) {
|
||||
Ok(uuid) => sqlx::query_as::<Postgres, PKSystem>(
|
||||
"select * from systems where uuid = $1",
|
||||
)
|
||||
.bind(uuid),
|
||||
Err(_) => sqlx::query_as::<Postgres, PKSystem>(
|
||||
"select * from systems where hid = $1",
|
||||
)
|
||||
.bind(parse_hid(id)),
|
||||
Err(_) => match id.parse::<i64>() {
|
||||
Ok(parsed) => sqlx::query_as::<Postgres, PKSystem>(
|
||||
"select * from systems where id = (select system from accounts where uid = $1)"
|
||||
)
|
||||
.bind(parsed),
|
||||
Err(_) => sqlx::query_as::<Postgres, PKSystem>(
|
||||
"select * from systems where hid = $1",
|
||||
)
|
||||
.bind(parse_hid(id))
|
||||
},
|
||||
}
|
||||
.fetch_optional(&ctx.db)
|
||||
.await
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue