diff --git a/src/app_handlers.rs b/src/app_handlers.rs index cc94721..f056171 100644 --- a/src/app_handlers.rs +++ b/src/app_handlers.rs @@ -7,7 +7,7 @@ use hyper::StatusCode; use crate::{ app_state::AppState, services::{ - CreateReservationRequestService, GetOutboxService, ReservationDatabaseService, + GetOutboxService, ReservationDatabaseService, ReservationRequestService, ReservationService, SendReservationMessageService, UserService, }, }; @@ -30,7 +30,7 @@ pub async fn create_reservation( where DB: ReservationDatabaseService + Clone, MessageService: SendReservationMessageService + GetOutboxService, - ReservationRequest: CreateReservationRequestService, + ReservationRequest: ReservationRequestService, { let mut db = state.db.lock().await; let id = db.get_reservations().len() as u64 + 1; @@ -92,7 +92,7 @@ mod tests { use crate::{ database::MockDatabase, drivers::MockMailer, - entities::{CreateReservation, Reservation}, + entities::{Reservation, ReservationRequest}, messages::Email, }; use axum::{ @@ -112,7 +112,7 @@ mod tests { .route("/reservations", get(get_reservations)) .route( "/reservations", - post(create_reservation::, CreateReservation>), + post(create_reservation::, ReservationRequest>), ) .route("/reservations/:id", delete(delete_reservation)) .route("/mailer/outbox", get(get_outbox)) diff --git a/src/entities/mod.rs b/src/entities/mod.rs index 124e9d9..1100b0e 100644 --- a/src/entities/mod.rs +++ b/src/entities/mod.rs @@ -1,8 +1,7 @@ -pub mod create_reservation; pub mod reservation; +pub mod reservation_request; pub mod user; -#[allow(unused)] -pub use create_reservation::CreateReservation; pub use reservation::Reservation; +pub use reservation_request::ReservationRequest; pub use user::User; diff --git a/src/entities/create_reservation.rs b/src/entities/reservation_request.rs similarity index 67% rename from src/entities/create_reservation.rs rename to src/entities/reservation_request.rs index 214ee87..bef3f26 100644 --- a/src/entities/create_reservation.rs +++ b/src/entities/reservation_request.rs @@ -1,15 +1,15 @@ use serde::Deserialize; -use crate::services::CreateReservationRequestService; +use crate::services::ReservationRequestService; #[derive(Deserialize)] -pub struct CreateReservation { +pub struct ReservationRequest { name: String, email: String, room: String, } -impl CreateReservationRequestService for CreateReservation { +impl ReservationRequestService for ReservationRequest { fn name(&self) -> String { self.name.clone() } diff --git a/src/main.rs b/src/main.rs index 8707985..98a7a0f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,7 +10,7 @@ use app_handlers::{create_reservation, delete_reservation, get_outbox, get_reser use app_state::AppState; use database::MockDatabase; use drivers::MockMailer; -use entities::CreateReservation; +use entities::ReservationRequest; use messages::Email; use axum::{ @@ -28,7 +28,7 @@ async fn main() { .route("/reservations", get(get_reservations)) .route( "/reservations", - post(create_reservation::, CreateReservation>), + post(create_reservation::, ReservationRequest>), ) .route("/reservations/:id", delete(delete_reservation)) .route("/mailer/outbox", get(get_outbox)) diff --git a/src/services/mod.rs b/src/services/mod.rs index 24b734f..9e48b82 100644 --- a/src/services/mod.rs +++ b/src/services/mod.rs @@ -1,13 +1,13 @@ -pub mod create_reservation_request_service; pub mod database_service; pub mod message_service; pub mod reservation_message_service; +pub mod reservation_request_service; pub mod reservation_service; pub mod user_service; pub use self::message_service::{GetOutboxService, SendReservationMessageService}; pub use self::reservation_message_service::ReservationMessageService; -pub use create_reservation_request_service::CreateReservationRequestService; pub use database_service::ReservationDatabaseService; +pub use reservation_request_service::ReservationRequestService; pub use reservation_service::ReservationService; pub use user_service::UserService; diff --git a/src/services/create_reservation_request_service.rs b/src/services/reservation_request_service.rs similarity index 67% rename from src/services/create_reservation_request_service.rs rename to src/services/reservation_request_service.rs index 6762b19..9a45be3 100644 --- a/src/services/create_reservation_request_service.rs +++ b/src/services/reservation_request_service.rs @@ -1,4 +1,4 @@ -pub trait CreateReservationRequestService { +pub trait ReservationRequestService { fn name(&self) -> String; fn email(&self) -> String; fn room(&self) -> String;