mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-11 16:20:13 +00:00
oops
This commit is contained in:
parent
2e3390b27c
commit
a7f8cbf1bd
2 changed files with 26 additions and 2 deletions
|
|
@ -1,5 +1,9 @@
|
|||
use crate::{ApiContext, auth::AuthState, error::fail};
|
||||
use axum::{Extension, extract::State, response::Json};
|
||||
use axum::{
|
||||
Extension,
|
||||
extract::{Path, State},
|
||||
response::Json,
|
||||
};
|
||||
use fred::interfaces::*;
|
||||
use libpk::state::ShardState;
|
||||
use pk_macros::api_endpoint;
|
||||
|
|
@ -201,7 +205,9 @@ pub enum DashViewRequest {
|
|||
name: Option<String>,
|
||||
value: Option<String>,
|
||||
},
|
||||
Remove { id: String },
|
||||
Remove {
|
||||
id: String,
|
||||
},
|
||||
}
|
||||
|
||||
#[api_endpoint]
|
||||
|
|
@ -294,3 +300,20 @@ pub async fn dash_views(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[api_endpoint]
|
||||
pub async fn dash_view(State(ctx): State<ApiContext>, Path(id): Path<String>) -> Json<Value> {
|
||||
match sqlx::query_as::<Postgres, PKDashView>("select * from dash_views where id = $1")
|
||||
.bind(id)
|
||||
.fetch_optional(&ctx.db)
|
||||
.await
|
||||
{
|
||||
Ok(val) => {
|
||||
let Some(val) = val else {
|
||||
return Err(crate::error::GENERIC_BAD_REQUEST);
|
||||
};
|
||||
Ok(Json(val.to_json()))
|
||||
}
|
||||
Err(err) => fail!(?err, "failed to query dash views"),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue