Compare commits
1
Commits
main
...
feat/auth-login
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ffc72367d5 |
+8
-3
@@ -1,10 +1,15 @@
|
||||
use axum::{routing::get, Router};
|
||||
use v1::auth_router;
|
||||
|
||||
pub mod v1;
|
||||
pub mod v2;
|
||||
|
||||
pub async fn apps() -> Router {
|
||||
let v1_routes = Router::new().route("/", get(|| async { "Comming Soon v1" }));
|
||||
let v2_routes = Router::new().route("/", get(|| async { "Comming Soon v2" }));
|
||||
Router::new().nest("/v1", v1_routes).nest("/v2", v2_routes)
|
||||
let v1_routes = Router::new()
|
||||
.nest("/auth", auth_router())
|
||||
.route("/", get(|| async { "Comming Soon v1" }));
|
||||
|
||||
let v2_routes = Router::new().route("/", get(|| async { "Comming Soon v2" }));
|
||||
|
||||
Router::new().nest("/v1", v1_routes).nest("/v2", v2_routes)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
use super::{mutation_login, AuthLoginRequestDto};
|
||||
use axum::{response::Response, Json};
|
||||
|
||||
pub async fn post_login(Json(payload): Json<AuthLoginRequestDto>) -> Response {
|
||||
mutation_login(payload).await
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use utoipa::ToSchema;
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, ToSchema)]
|
||||
pub struct AuthLoginRequestDto {
|
||||
pub email: String,
|
||||
pub password: String,
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
use super::auth_dto::AuthLoginRequestDto;
|
||||
use crate::{success_response, ResponseSuccessDto};
|
||||
use axum::response::Response;
|
||||
|
||||
pub async fn mutation_login(params: AuthLoginRequestDto) -> Response {
|
||||
let response = ResponseSuccessDto {
|
||||
data: AuthLoginRequestDto {
|
||||
email: params.email,
|
||||
password: params.password,
|
||||
},
|
||||
};
|
||||
success_response(response)
|
||||
}
|
||||
|
||||
@@ -1,4 +1,13 @@
|
||||
use axum::{routing::post, Router};
|
||||
|
||||
pub mod auth_controller;
|
||||
pub mod auth_dto;
|
||||
pub mod auth_middleware;
|
||||
pub mod auth_repository;
|
||||
|
||||
pub use auth_dto::*;
|
||||
pub use auth_repository::*;
|
||||
|
||||
pub fn auth_router() -> Router {
|
||||
Router::new().route("/login", post(auth_controller::post_login))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user