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