feat: v0.3.0 — standardize codebase, centralize infra, merge QR into CMS
- Enforce axum best practices across all 13 workspace crates (max 200 LOC/file, no comments, no unwrap, clean architecture) - Fix domain→infrastructure dependency inversions in imphnen-iam and imphnen-dimentorin - Extract imphnen-storage (MinIO) and imphnen-email (Lettre) as standalone crates - Centralize all config in ENV struct: CDN_URL, CORS_ALLOWED_ORIGINS - Centralize SMTP through imphnen-email; remove dead HackathonConfig - Centralize database: QR crate now shares main DB pool (single DATABASE_URL) - Rename QR users table to qr_users to avoid collision with main users table - Merge imphnen-qr into imphnen-cms/src/qr (13 crates, down from 14) - Restructure imphnen-hackathon flat modules into clean architecture - Remove all stale env vars from .env.example (SurrealDB, QR_JWT, Hackathon infra) - Fix Dockerfile to include all current workspace crates - Bump all crate versions 0.2.0 → 0.3.0 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
2ae43b3bcc
commit
331a4a4e88
@@ -1,29 +1,34 @@
|
||||
use std::sync::Arc;
|
||||
use axum::{Router, routing::post, Extension};
|
||||
use sea_orm::DatabaseConnection;
|
||||
use imphnen_libs::AppState;
|
||||
use crate::auth::domain::AuthService;
|
||||
use crate::auth::application::AuthServiceImpl;
|
||||
use crate::users::infrastructure::persistence::PostgresUserRepository;
|
||||
use crate::roles::infrastructure::persistence::PostgresRoleRepository;
|
||||
use super::handlers::{
|
||||
post_login, post_login_mentor, post_register, post_verify_email,
|
||||
post_resend_otp, post_forgot_password, post_new_password, post_refresh_token,
|
||||
post_forgot_password, post_login, post_login_mentor, post_new_password,
|
||||
post_refresh_token, post_register, post_resend_otp, post_verify_email,
|
||||
};
|
||||
use crate::auth::application::AuthServiceImpl;
|
||||
use crate::auth::domain::AuthService;
|
||||
use crate::roles::infrastructure::persistence::PostgresRoleRepository;
|
||||
use crate::users::infrastructure::persistence::PostgresUserRepository;
|
||||
use axum::{Extension, Router, routing::post};
|
||||
use imphnen_libs::AppState;
|
||||
use sea_orm::DatabaseConnection;
|
||||
use std::sync::Arc;
|
||||
|
||||
pub fn auth_public_routes(_db: DatabaseConnection, state: Arc<AppState>) -> Router {
|
||||
let user_repo = Arc::new(PostgresUserRepository::new(state.postgres_connection.conn.clone()));
|
||||
let role_repo = Arc::new(PostgresRoleRepository::new(state.postgres_connection.conn.clone()));
|
||||
let auth_service: Arc<dyn AuthService> = Arc::new(AuthServiceImpl::new(user_repo, role_repo));
|
||||
Router::new()
|
||||
.route("/auth/login", post(post_login))
|
||||
.route("/auth/login-mentor", post(post_login_mentor))
|
||||
.route("/auth/register", post(post_register))
|
||||
.route("/auth/verify-email", post(post_verify_email))
|
||||
.route("/auth/send-otp", post(post_resend_otp))
|
||||
.route("/auth/forgot", post(post_forgot_password))
|
||||
.route("/auth/new-password", post(post_new_password))
|
||||
.route("/auth/refresh", post(post_refresh_token))
|
||||
.layer(Extension(auth_service))
|
||||
.layer(Extension((*state).clone()))
|
||||
let user_repo = Arc::new(PostgresUserRepository::new(
|
||||
state.postgres_connection.conn.clone(),
|
||||
));
|
||||
let role_repo = Arc::new(PostgresRoleRepository::new(
|
||||
state.postgres_connection.conn.clone(),
|
||||
));
|
||||
let auth_service: Arc<dyn AuthService> =
|
||||
Arc::new(AuthServiceImpl::new(user_repo, role_repo));
|
||||
Router::new()
|
||||
.route("/auth/login", post(post_login))
|
||||
.route("/auth/login-mentor", post(post_login_mentor))
|
||||
.route("/auth/register", post(post_register))
|
||||
.route("/auth/verify-email", post(post_verify_email))
|
||||
.route("/auth/send-otp", post(post_resend_otp))
|
||||
.route("/auth/forgot", post(post_forgot_password))
|
||||
.route("/auth/new-password", post(post_new_password))
|
||||
.route("/auth/refresh", post(post_refresh_token))
|
||||
.layer(Extension(auth_service))
|
||||
.layer(Extension((*state).clone()))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user