2025-03-14 17:50:37 +07:00
|
|
|
use crate::{
|
2025-03-18 14:13:53 +07:00
|
|
|
v1::{
|
|
|
|
|
auth, gacha, AuthLoginRequestDto, AuthLoginResponsetDto,
|
2025-03-19 23:17:50 +07:00
|
|
|
AuthResendOtpRequestDto, AuthVerifyEmailRequestDto, GachaCreateClaimRequestDto,
|
|
|
|
|
GachaCreateItemRequestDto, GachaCreateRollRequestDto,
|
2025-03-18 14:13:53 +07:00
|
|
|
},
|
2025-03-14 17:50:37 +07:00
|
|
|
MessageResponseDto, MetaRequestDto, MetaResponseDto, ResponseSuccessDto,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
use utoipa::{
|
|
|
|
|
openapi::security::{Http, HttpAuthScheme, SecurityScheme},
|
|
|
|
|
Modify, OpenApi,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#[derive(OpenApi)]
|
|
|
|
|
#[openapi(
|
|
|
|
|
paths(
|
|
|
|
|
auth::auth_controller::post_login,
|
2025-03-18 14:13:53 +07:00
|
|
|
auth::auth_controller::post_register,
|
2025-03-19 23:17:50 +07:00
|
|
|
auth::auth_controller::post_verify_email,
|
|
|
|
|
auth::auth_controller::post_resend_otp,
|
2025-03-18 14:13:53 +07:00
|
|
|
gacha::gacha_controller::post_create_gacha_claim,
|
|
|
|
|
gacha::gacha_controller::post_create_gacha_item,
|
2025-03-19 20:55:29 +07:00
|
|
|
gacha::gacha_controller::post_create_gacha_roll
|
2025-03-14 17:50:37 +07:00
|
|
|
),
|
|
|
|
|
components(
|
|
|
|
|
schemas(
|
|
|
|
|
MetaRequestDto,
|
|
|
|
|
MetaResponseDto,
|
|
|
|
|
MessageResponseDto,
|
|
|
|
|
AuthLoginRequestDto,
|
|
|
|
|
AuthLoginResponsetDto,
|
2025-03-19 23:17:50 +07:00
|
|
|
AuthVerifyEmailRequestDto,
|
|
|
|
|
AuthResendOtpRequestDto,
|
2025-03-14 17:50:37 +07:00
|
|
|
ResponseSuccessDto<AuthLoginResponsetDto>,
|
2025-03-18 14:13:53 +07:00
|
|
|
GachaCreateClaimRequestDto,
|
|
|
|
|
GachaCreateItemRequestDto,
|
|
|
|
|
GachaCreateRollRequestDto
|
2025-03-14 17:50:37 +07:00
|
|
|
)
|
|
|
|
|
),
|
|
|
|
|
info(
|
|
|
|
|
title = "IMPHNEN API",
|
|
|
|
|
description = "IMPHNEN API Documentation",
|
|
|
|
|
version = "0.1.0",
|
|
|
|
|
contact(
|
|
|
|
|
name = "Maulana Sodiqin",
|
|
|
|
|
url = ""
|
|
|
|
|
),
|
|
|
|
|
license(
|
|
|
|
|
name = "MIT",
|
|
|
|
|
url = "https://opensource.org/licenses/MIT"
|
|
|
|
|
)
|
|
|
|
|
),
|
|
|
|
|
modifiers(&SecurityAddon),
|
|
|
|
|
tags(
|
|
|
|
|
(name = "Authentication", description = "List of Authentication Endpoints"),
|
|
|
|
|
)
|
|
|
|
|
)]
|
|
|
|
|
|
|
|
|
|
pub struct ApiDoc;
|
|
|
|
|
|
|
|
|
|
struct SecurityAddon;
|
|
|
|
|
|
|
|
|
|
impl Modify for SecurityAddon {
|
|
|
|
|
fn modify(&self, openapi: &mut utoipa::openapi::OpenApi) {
|
|
|
|
|
if let Some(components) = openapi.components.as_mut() {
|
|
|
|
|
components.add_security_scheme(
|
|
|
|
|
"Bearer",
|
|
|
|
|
SecurityScheme::Http(Http::new(HttpAuthScheme::Bearer)),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|