-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
edfaa6c
commit 787b4bc
Showing
3 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
src/api/rest_api/handlers/admin_user/fetch_admin_user_api_handler.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use std::sync::Arc; | ||
use crate::{ | ||
avored_state::AvoRedState, error::Result | ||
}; | ||
|
||
use axum::{extract::{Path as AxumPath, State}, Json, response::IntoResponse}; | ||
use serde::Serialize; | ||
use crate::models::admin_user_model::AdminUserModel; | ||
|
||
pub async fn fetch_admin_user_api_handler( | ||
AxumPath(admin_user_id): AxumPath<String>, | ||
state: State<Arc<AvoRedState>> | ||
) -> Result<impl IntoResponse> { | ||
println!("->> {:<12} - fetch_admin_user_api_handler", "HANDLER"); | ||
|
||
let admin_user_model = state | ||
.admin_user_service | ||
.find_by_id(&state.db, admin_user_id) | ||
.await?; | ||
let response = FetchAdminUserResponse { | ||
status: true, | ||
admin_user_model: admin_user_model | ||
}; | ||
|
||
Ok(Json(response)) | ||
} | ||
|
||
|
||
#[derive(Serialize, Debug)] | ||
pub struct FetchAdminUserResponse { | ||
pub status: bool, | ||
pub admin_user_model: AdminUserModel | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters