feat: user relation

This commit is contained in:
Maulana Sodiqin
2025-03-14 17:50:37 +07:00
parent 9ffe808797
commit 7ab036f5f7
22 changed files with 358 additions and 28 deletions
+23 -1
View File
@@ -1,7 +1,19 @@
use super::{AuthLoginRequestDto, AuthRegisterRequestDto, AuthService};
use crate::AppState;
use crate::{v1::AuthLoginResponsetDto, AppState};
use axum::{response::IntoResponse, Extension, Json};
use crate::{MessageResponseDto, ResponseSuccessDto};
#[utoipa::path(
post,
path = "/v1/auth/login",
request_body = AuthLoginRequestDto,
responses(
(status = 200, description = "Login successful", body = ResponseSuccessDto<AuthLoginResponsetDto>),
(status = 401, description = "Unauthorized", body = MessageResponseDto)
),
tag = "Authentication"
)]
pub async fn post_login(
Extension(state): Extension<AppState>,
Json(payload): Json<AuthLoginRequestDto>,
@@ -9,6 +21,16 @@ pub async fn post_login(
AuthService::mutation_login(payload, &state).await
}
#[utoipa::path(
post,
path = "/v1/auth/register",
request_body = AuthRegisterRequestDto,
responses(
(status = 200, description = "Login successful", body = MessageResponseDto),
(status = 401, description = "Unauthorized", body = MessageResponseDto)
),
tag = "Authentication"
)]
pub async fn post_register(
Extension(state): Extension<AppState>,
Json(payload): Json<AuthRegisterRequestDto>,