From d08449185ed502102b2a98de956f6ba9804184bd Mon Sep 17 00:00:00 2001 From: Tracewebstudio Dev Date: Thu, 16 Apr 2026 18:06:06 +0200 Subject: [PATCH] feat: add v1 users API routes for backward compatibility - Add /api/v1/users path routing to users service in gateway - Add v1_router() in auth.rs with resend-otp endpoint - Nest /api/v1/users route in main.rs - Support legacy /api/v1/users/resend-otp endpoint --- apps/gateway/src/main.rs | 1 + apps/users/src/handlers/auth.rs | 7 +++++++ apps/users/src/main.rs | 2 ++ 3 files changed, 10 insertions(+) diff --git a/apps/gateway/src/main.rs b/apps/gateway/src/main.rs index 3433561..1c66dde 100644 --- a/apps/gateway/src/main.rs +++ b/apps/gateway/src/main.rs @@ -84,6 +84,7 @@ impl Services { // Auth, users, roles, notifications, runtime-config, config, KB, support if path.starts_with("/api/auth") || path.starts_with("/api/users") + || path.starts_with("/api/v1/users") || path.starts_with("/api/me") || path.starts_with("/api/profile") || path.starts_with("/api/onboarding") diff --git a/apps/users/src/handlers/auth.rs b/apps/users/src/handlers/auth.rs index a6c30e0..7ac3850 100644 --- a/apps/users/src/handlers/auth.rs +++ b/apps/users/src/handlers/auth.rs @@ -724,3 +724,10 @@ async fn switch_role( "expires_in": 900 })))) } + +// ── V1 API Router (for backward compatibility) ───────────────────────── + +pub fn v1_router() -> Router { + Router::new() + .route("/resend-otp", post(resend_otp)) +} diff --git a/apps/users/src/main.rs b/apps/users/src/main.rs index f8873db..6f76b66 100644 --- a/apps/users/src/main.rs +++ b/apps/users/src/main.rs @@ -54,6 +54,8 @@ async fn main() { let app = Router::new() // ── Auth ───────────────────────────────────────────────────────── .nest("/api/auth", handlers::auth::router()) + // ── V1 API (backward compatibility) ─────────────────────────────── + .nest("/api/v1/users", handlers::auth::v1_router()) // ── Roles & User Self-Service ───────────────────────────────────── .nest("/api/admin/roles", handlers::roles::router()) .nest("/api/admin/permissions", handlers::permissions::router())