Skip to content

Commit

Permalink
feat: add sort, search and order
Browse files Browse the repository at this point in the history
  • Loading branch information
maulanasdqn committed Dec 31, 2024
1 parent 20240d4 commit f158a97
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/app/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ pub async fn routes() -> Router {
reservations::reservation_dto::ReservationDto,
reservations::reservation_dto::ReservationListResponse,
reservations::reservation_dto::ReservationDetailResponse,
reservations::reservation_dto::TMetas
reservations::reservation_dto::TMetas,
reservations::reservation_dto::TMetaParam
)
),
info(
Expand Down
4 changes: 2 additions & 2 deletions src/app/reservations/reservation_controller.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::reservations::reservation_dto::TMetas;
use crate::reservations::reservation_dto::{TMetaParam, TMetas};

use super::{
reservation_dto::ReservationDto,
Expand All @@ -9,7 +9,7 @@ use axum::{extract::Query, response::IntoResponse, Json};
#[utoipa::path(
get,
path = "/api/reservations",
params(TMetas),
params(TMetaParam),
security(
("Bearer" = [])
),
Expand Down
9 changes: 9 additions & 0 deletions src/app/reservations/reservation_dto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,12 @@ pub struct TMetas {
pub page: Option<u32>,
pub per_page: Option<u32>,
}

#[derive(Debug, Clone, Serialize, Deserialize, ToSchema, IntoParams)]
pub struct TMetaParam {
pub page: Option<u32>,
pub per_page: Option<u32>,
pub search: Option<String>,
pub order_by: Option<String>,
pub sort: Option<String>,
}

0 comments on commit f158a97

Please # to comment.