mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-14 01:30:13 +00:00
chore: reorganize rust crates
This commit is contained in:
parent
357122a892
commit
16ce67e02c
58 changed files with 6 additions and 13 deletions
20
crates/libpk/src/db/repository/auth.rs
Normal file
20
crates/libpk/src/db/repository/auth.rs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
pub async fn legacy_token_auth(
|
||||
pool: &sqlx::postgres::PgPool,
|
||||
token: &str,
|
||||
) -> anyhow::Result<Option<i32>> {
|
||||
let mut system: Vec<LegacyTokenDbResponse> =
|
||||
sqlx::query_as("select id from systems where token = $1")
|
||||
.bind(token)
|
||||
.fetch_all(pool)
|
||||
.await?;
|
||||
Ok(if let Some(system) = system.pop() {
|
||||
Some(system.id)
|
||||
} else {
|
||||
None
|
||||
})
|
||||
}
|
||||
|
||||
#[derive(sqlx::FromRow)]
|
||||
struct LegacyTokenDbResponse {
|
||||
id: i32,
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue