-
-
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
ab36f19
commit 421cdc0
Showing
3 changed files
with
32 additions
and
2 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
src/api/rest_api/handlers/admin_user/admin_user_table_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,26 @@ | ||
use std::sync::Arc; | ||
use axum::extract::{Query, State}; | ||
use axum::Json; | ||
use serde::Serialize; | ||
use crate::api::rest_api::handlers::page::request::page_table_request::PageTableRequest; | ||
use crate::avored_state::AvoRedState; | ||
use crate::error::Result; | ||
use crate::models::admin_user_model::AdminUserPagination; | ||
pub async fn admin_user_table_api_handler( | ||
state: State<Arc<AvoRedState>>, | ||
Query(query_param): Query<PageTableRequest>, | ||
) -> Result<Json<AdminUserPagination>> { | ||
println!("->> {:<12} - admin_user_table_api_handler", "HANDLER"); | ||
|
||
let current_page = query_param.page.unwrap_or(1); | ||
let admin_user_pagination = state.admin_user_service.paginate(&state.db, current_page).await?; | ||
|
||
Ok(Json(admin_user_pagination)) | ||
} | ||
|
||
|
||
#[derive(Serialize, Debug)] | ||
pub struct FetchPageResponse { | ||
pub status: bool, | ||
pub page_model: AdminUserPagination | ||
} |
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
pub mod admin_user_login_api_handler; | ||
pub mod admin_user_login_api_handler; | ||
pub mod admin_user_table_api_handler; |
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