feat: allow getting user profile via json api
This commit is contained in:
parent
5d9c016e8e
commit
82a81422d6
6 changed files with 21 additions and 8 deletions
|
|
@ -1 +1,2 @@
|
|||
pub mod oauth;
|
||||
pub mod oauth;
|
||||
pub mod users;
|
||||
|
|
@ -1 +1,2 @@
|
|||
pub mod generate_token;
|
||||
pub mod generate_token;
|
||||
|
||||
|
|
|
|||
1
src/json_api/users/mod.rs
Normal file
1
src/json_api/users/mod.rs
Normal file
|
|
@ -0,0 +1 @@
|
|||
pub mod profile;
|
||||
10
src/json_api/users/profile.rs
Normal file
10
src/json_api/users/profile.rs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
use rocket::serde::json::Json;
|
||||
use rocket::{get, State};
|
||||
use crate::account::account::Auth;
|
||||
use crate::nnid::people::{build_profile, GetOwnProfileData};
|
||||
use crate::Pool;
|
||||
|
||||
#[get("/api/v2/users/@me/profile")]
|
||||
pub async fn get_own_profile(pool: &State<Pool>, auth: Auth<true>) -> Json<GetOwnProfileData> {
|
||||
Json(build_profile(auth.into()))
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue