feat: add module prefixes to all routes and load all modules in swagger

Route structure:
  /v1/iam/auth/*         (was /v1/auth/*)
  /v1/iam/users/*        (was /v1/users/*)
  /v1/iam/roles/*        (was /v1/roles/*)
  /v1/iam/permissions/*  (was /v1/permissions/*)
  /v1/landing/cms/events/*        (was /v1/cms/landing/events/*)
  /v1/landing/cms/testimonials/*  (was /v1/cms/landing/testimonials/*)
  /v1/dimentorin/mentors/*   (was /v1/mentors/*)
  /v1/dimentorin/sessions/*  (was /v1/sessions/*)
  /v1/gacha/*            (unchanged)
  /v1/hackathon/*        (unchanged)
  /v1/qr/*               (unchanged)

Swagger: add gacha_credits endpoints which were missing from OpenAPI spec.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
maulanasdqn
2026-04-03 00:26:29 +07:00
co-authored by Claude Sonnet 4.6
parent c38b718eb4
commit 76201d8d3e
17 changed files with 115 additions and 97 deletions
@@ -21,7 +21,7 @@ use uuid::Uuid;
#[utoipa::path(
get,
path = "/v1/cms/landing/events",
path = "/v1/landing/cms/events",
params(
("page" = Option<i64>, Query, description = "Page number"),
("per_page" = Option<i64>, Query, description = "Items per page"),
@@ -57,7 +57,7 @@ pub async fn get_event_list(
#[utoipa::path(
get,
path = "/v1/cms/landing/events/detail/{id}",
path = "/v1/landing/cms/events/detail/{id}",
params(
("id" = String, Path, description = "Event ID")
),
@@ -90,7 +90,7 @@ pub async fn get_event_by_id(
#[utoipa::path(
post,
security(("Bearer" = [])),
path = "/v1/cms/landing/events/create",
path = "/v1/landing/cms/events/create",
request_body = EventsCreateRequestDto,
responses(
(status = 201, description = "[ADMIN] Create new event")
@@ -113,7 +113,7 @@ pub async fn post_create_event(
#[utoipa::path(
patch,
security(("Bearer" = [])),
path = "/v1/cms/landing/events/update/{id}",
path = "/v1/landing/cms/events/update/{id}",
params(
("id" = String, Path, description = "Event ID")
),
@@ -156,7 +156,7 @@ pub async fn patch_update_event(
#[utoipa::path(
delete,
security(("Bearer" = [])),
path = "/v1/cms/landing/events/delete/{id}",
path = "/v1/landing/cms/events/delete/{id}",
params(
("id" = String, Path, description = "Event ID")
),
@@ -20,16 +20,16 @@ fn build_service(db: DatabaseConnection) -> Arc<dyn EventService> {
pub fn events_public_routes(db: DatabaseConnection) -> Router {
let service = build_service(db);
Router::new()
.route("/cms/landing/events", get(get_event_list))
.route("/cms/landing/events/detail/{id}", get(get_event_by_id))
.route("/events", get(get_event_list))
.route("/events/detail/{id}", get(get_event_by_id))
.layer(Extension(service))
}
pub fn events_protected_routes(db: DatabaseConnection) -> Router {
let service = build_service(db);
Router::new()
.route("/cms/landing/events/create", post(post_create_event))
.route("/cms/landing/events/update/{id}", patch(patch_update_event))
.route("/cms/landing/events/delete/{id}", delete(delete_event))
.route("/events/create", post(post_create_event))
.route("/events/update/{id}", patch(patch_update_event))
.route("/events/delete/{id}", delete(delete_event))
.layer(Extension(service))
}
@@ -24,7 +24,7 @@ use uuid::Uuid;
#[utoipa::path(
get,
path = "/v1/cms/landing/testimonials",
path = "/v1/landing/cms/testimonials",
params(
("page" = Option<i64>, Query, description = "Page number"),
("per_page" = Option<i64>, Query, description = "Items per page"),
@@ -62,7 +62,7 @@ pub async fn get_testimonial_list(
#[utoipa::path(
get,
path = "/v1/cms/landing/testimonials/detail/{id}",
path = "/v1/landing/cms/testimonials/detail/{id}",
params(
("id" = String, Path, description = "Testimonial ID")
),
@@ -96,7 +96,7 @@ pub async fn get_testimonial_by_id(
#[utoipa::path(
post,
security(("Bearer" = [])),
path = "/v1/cms/landing/testimonials/create",
path = "/v1/landing/cms/testimonials/create",
request_body = TestimonialsCreateRequestDto,
responses(
(status = 201, description = "[USER] Create new testimonial", body = ResponseSuccessDto<TestimonialsDetailItemDto>)
@@ -139,7 +139,7 @@ pub async fn post_create_testimonial(
#[utoipa::path(
patch,
security(("Bearer" = [])),
path = "/v1/cms/landing/testimonials/update/{id}",
path = "/v1/landing/cms/testimonials/update/{id}",
params(
("id" = String, Path, description = "Testimonial ID")
),
@@ -178,7 +178,7 @@ pub async fn patch_update_testimonial(
#[utoipa::path(
delete,
security(("Bearer" = [])),
path = "/v1/cms/landing/testimonials/delete/{id}",
path = "/v1/landing/cms/testimonials/delete/{id}",
params(
("id" = String, Path, description = "Testimonial ID")
),
@@ -20,9 +20,9 @@ fn build_service(db: DatabaseConnection) -> Arc<dyn TestimonialService> {
pub fn testimonials_public_routes(db: DatabaseConnection) -> Router {
let service = build_service(db);
Router::new()
.route("/cms/landing/testimonials", get(get_testimonial_list))
.route("/testimonials", get(get_testimonial_list))
.route(
"/cms/landing/testimonials/detail/{id}",
"/testimonials/detail/{id}",
get(get_testimonial_by_id),
)
.layer(Extension(service))
@@ -32,15 +32,15 @@ pub fn testimonials_protected_routes(db: DatabaseConnection) -> Router {
let service = build_service(db);
Router::new()
.route(
"/cms/landing/testimonials/create",
"/testimonials/create",
post(post_create_testimonial),
)
.route(
"/cms/landing/testimonials/update/{id}",
"/testimonials/update/{id}",
patch(patch_update_testimonial),
)
.route(
"/cms/landing/testimonials/delete/{id}",
"/testimonials/delete/{id}",
delete(delete_testimonial),
)
.layer(Extension(service))