Fix users service startup panic — route syntax and admin login

- All /:param routes converted to /{param} (Axum v0.8 breaking change)
- admin.rs, kb.rs, reviews.rs, support.rs, pricing.rs, coupons.rs fixed
- employees app routes fixed (departments, designations, employees handlers)
- kb.rs multiline route definitions also fixed
- Users service now boots successfully

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Ashwin Kumar 2026-04-03 02:32:46 +02:00
parent 3935277fb7
commit 5451ff5657
9 changed files with 16 additions and 16 deletions

View file

@ -14,7 +14,7 @@ use db::models::department::{DepartmentRepository, CreateDepartmentPayload};
pub fn router() -> Router<AppState> {
Router::new()
.route("/", get(list_departments).post(create_department))
.route("/:id", patch(update_department).delete(delete_department))
.route("/{id}", patch(update_department).delete(delete_department))
}
async fn list_departments(

View file

@ -14,8 +14,8 @@ use db::models::designation::{DesignationRepository, CreateDesignationPayload};
pub fn router() -> Router<AppState> {
Router::new()
.route("/", get(list_all_designations).post(create_designation))
.route("/department/:dept_id", get(list_by_department))
.route("/:id", patch(update_designation).delete(delete_designation))
.route("/department/{dept_id}", get(list_by_department))
.route("/{id}", patch(update_designation).delete(delete_designation))
}
async fn list_all_designations(

View file

@ -14,7 +14,7 @@ use db::models::employee::{Employee, EmployeeRepository, CreateEmployeePayload};
pub fn router() -> Router<AppState> {
Router::new()
.route("/", get(list_employees).post(create_employee))
.route("/:id", get(get_employee).patch(update_employee).delete(delete_employee))
.route("/{id}", get(get_employee).patch(update_employee).delete(delete_employee))
}
#[derive(Deserialize)]

View file

@ -16,7 +16,7 @@ pub fn router() -> Router<AppState> {
.route("/users", get(list_users))
.route("/customers", get(list_customers))
.route("/candidates", get(list_candidates))
.route("/users/:id/status", axum::routing::patch(update_user_status))
.route("/users/{id}/status", axum::routing::patch(update_user_status))
}
#[derive(Deserialize)]

View file

@ -15,13 +15,13 @@ use uuid::Uuid;
pub fn coupons_router() -> Router<AppState> {
Router::new()
.route("/", get(list_coupons).post(create_coupon))
.route("/:id", patch(update_coupon).delete(delete_coupon))
.route("/{id}", patch(update_coupon).delete(delete_coupon))
}
pub fn discounts_router() -> Router<AppState> {
Router::new()
.route("/", get(list_discounts).post(create_discount))
.route("/:id", patch(update_discount))
.route("/{id}", patch(update_discount))
}
// ── Coupon DTOs ───────────────────────────────────────────────────────────────

View file

@ -17,7 +17,7 @@ pub fn public_router() -> Router<AppState> {
Router::new()
.route("/categories", get(public_list_categories))
.route("/articles", get(public_list_articles))
.route("/articles/:slug", get(public_get_article))
.route("/articles/{slug}", get(public_get_article))
}
/// Admin CRUD routes
@ -26,13 +26,13 @@ pub fn admin_router() -> Router<AppState> {
// Categories
.route("/categories", get(admin_list_categories).post(admin_create_category))
.route(
"/categories/:id",
"/categories/{id}",
patch(admin_update_category).delete(admin_delete_category),
)
// Articles
.route("/articles", get(admin_list_articles).post(admin_create_article))
.route(
"/articles/:id",
"/articles/{id}",
get(admin_get_article)
.patch(admin_update_article)
.delete(admin_delete_article),

View file

@ -21,7 +21,7 @@ pub fn public_packages_router() -> Router<AppState> {
pub fn packages_router() -> Router<AppState> {
Router::new()
.route("/", get(list_packages).post(create_package))
.route("/:id", patch(update_package).delete(delete_package))
.route("/{id}", patch(update_package).delete(delete_package))
}
pub fn reports_router() -> Router<AppState> {

View file

@ -15,7 +15,7 @@ use uuid::Uuid;
pub fn admin_router() -> Router<AppState> {
Router::new()
.route("/", get(admin_list_reviews).post(admin_create_review))
.route("/:id", axum::routing::patch(admin_update_review).delete(admin_delete_review))
.route("/{id}", axum::routing::patch(admin_update_review).delete(admin_delete_review))
}
// ── DTOs ──────────────────────────────────────────────────────────────────────

View file

@ -16,16 +16,16 @@ use uuid::Uuid;
pub fn user_router() -> Router<AppState> {
Router::new()
.route("/", post(user_create_ticket).get(user_list_tickets))
.route("/:id", get(user_get_ticket))
.route("/:id/messages", post(user_add_message))
.route("/{id}", get(user_get_ticket))
.route("/{id}/messages", post(user_add_message))
}
/// Admin support routes
pub fn admin_router() -> Router<AppState> {
Router::new()
.route("/", get(admin_list_cases).post(admin_create_case))
.route("/:id", get(admin_get_case).patch(admin_update_case))
.route("/:id/messages", post(admin_add_message))
.route("/{id}", get(admin_get_case).patch(admin_update_case))
.route("/{id}/messages", post(admin_add_message))
}
// ── DTOs ──────────────────────────────────────────────────────────────────────