feat: auth login
This commit is contained in:
@@ -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