feat: docs
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
use crate::{AppState, RedisClient, SurrealClient};
|
||||
use axum::{Extension, Router};
|
||||
use utoipa_swagger_ui::SwaggerUi;
|
||||
|
||||
pub mod v1;
|
||||
pub mod v2;
|
||||
@@ -9,5 +10,6 @@ pub async fn apps(surrealdb: SurrealClient, redisdb: RedisClient) -> Router {
|
||||
Router::new()
|
||||
.nest("/v1", v1::routes().await)
|
||||
.nest("/v2", v2::routes().await)
|
||||
.merge(SwaggerUi::new("/docs").url("/openapi.json", v1::docs_router()))
|
||||
.layer(Extension(state))
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ use utoipa::{
|
||||
auth::auth_controller::post_register,
|
||||
gacha::gacha_controller::post_create_gacha_claim,
|
||||
gacha::gacha_controller::post_create_gacha_item,
|
||||
gacha::gacha_controller::post_create_gacha_roll,
|
||||
gacha::gacha_controller::post_create_gacha_roll
|
||||
),
|
||||
components(
|
||||
schemas(
|
||||
@@ -50,7 +50,6 @@ use utoipa::{
|
||||
modifiers(&SecurityAddon),
|
||||
tags(
|
||||
(name = "Authentication", description = "List of Authentication Endpoints"),
|
||||
(name = "Users", description = "List of Users Endpoints")
|
||||
)
|
||||
)]
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ use axum::{http::HeaderMap, response::IntoResponse, Extension, Json};
|
||||
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/v1/gacha/create/claim",
|
||||
path = "/v1/gacha/claims/create",
|
||||
request_body = GachaCreateClaimRequestDto,
|
||||
responses(
|
||||
(status = 200, description = "Create gacha claim successful", body = MessageResponseDto),
|
||||
@@ -22,7 +22,7 @@ pub async fn post_create_gacha_claim(
|
||||
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/v1/gacha/create/item",
|
||||
path = "/v1/gacha/items/create",
|
||||
request_body = GachaCreateItemRequestDto,
|
||||
responses(
|
||||
(status = 200, description = "Create gacha item successful", body = MessageResponseDto),
|
||||
@@ -39,7 +39,7 @@ pub async fn post_create_gacha_item(
|
||||
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/v1/gacha/create/roll",
|
||||
path = "/v1/gacha/rolls/create",
|
||||
request_body = GachaCreateRollRequestDto,
|
||||
responses(
|
||||
(status = 200, description = "Create gacha roll successful", body = MessageResponseDto),
|
||||
|
||||
@@ -14,15 +14,15 @@ pub use gacha_service::*;
|
||||
pub fn gacha_router() -> Router {
|
||||
Router::new()
|
||||
.route(
|
||||
"/create/claim",
|
||||
"/claims/create",
|
||||
post(gacha_controller::post_create_gacha_claim),
|
||||
)
|
||||
.route(
|
||||
"/create/item",
|
||||
"/items/create",
|
||||
post(gacha_controller::post_create_gacha_item),
|
||||
)
|
||||
.route(
|
||||
"/create/roll",
|
||||
"/rolls/create",
|
||||
post(gacha_controller::post_create_gacha_roll),
|
||||
)
|
||||
}
|
||||
|
||||
+1
-5
@@ -8,7 +8,6 @@ pub use auth::*;
|
||||
pub use docs::*;
|
||||
pub use gacha::*;
|
||||
pub use users::*;
|
||||
use utoipa_swagger_ui::SwaggerUi;
|
||||
|
||||
pub async fn routes() -> Router {
|
||||
let public_routes = Router::new().nest("/auth", auth_router());
|
||||
@@ -17,8 +16,5 @@ pub async fn routes() -> Router {
|
||||
.nest("/gacha", gacha_router())
|
||||
.layer(from_fn(auth::auth_middleware::auth_middleware));
|
||||
|
||||
Router::new()
|
||||
.merge(public_routes)
|
||||
.merge(protected_routes)
|
||||
.merge(SwaggerUi::new("/v1/docs").url("/openapi.json", docs_router()))
|
||||
Router::new().merge(public_routes).merge(protected_routes)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user