feat: allow accessing mii data via json api
This commit is contained in:
parent
82a81422d6
commit
087f1875e9
3 changed files with 26 additions and 1 deletions
22
src/json_api/users/mii.rs
Normal file
22
src/json_api/users/mii.rs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
use rocket::{get, State};
|
||||
use rocket::serde::json::Json;
|
||||
use serde::de::IntoDeserializer;
|
||||
use sqlx::query;
|
||||
use crate::account::account::Auth;
|
||||
use crate::nnid::people::{build_profile, GetOwnProfileData};
|
||||
use crate::Pool;
|
||||
|
||||
|
||||
|
||||
#[get("/api/v2/users/<pid>/mii")]
|
||||
pub async fn get_mii_data_by_pid(pool: &State<Pool>, pid: i32) -> Option<Json<String>> {
|
||||
let pool = pool.inner();
|
||||
|
||||
let mii_data = query!("SELECT mii_data from users where pid = $1", pid).fetch_one(pool).await;
|
||||
|
||||
let Ok(mii_data) = mii_data else {
|
||||
return None;
|
||||
};
|
||||
|
||||
Some(Json(mii_data.mii_data))
|
||||
}
|
||||
|
|
@ -1 +1,2 @@
|
|||
pub mod profile;
|
||||
pub mod profile;
|
||||
pub mod mii;
|
||||
|
|
@ -150,8 +150,10 @@ async fn launch() -> _ {
|
|||
nnid::mapped_ids::mapped_ids,
|
||||
json_api::oauth::generate_token::generate_token,
|
||||
json_api::users::profile::get_own_profile,
|
||||
json_api::users::mii::get_mii_data_by_pid,
|
||||
papi::login::login,
|
||||
papi::user::get_user,
|
||||
|
||||
// graphql::graphiql,
|
||||
// graphql::playground,
|
||||
graphql::get_graphql,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue