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:
maulanasdqn
2026-04-02 22:29:08 +07:00
co-authored by Claude Sonnet 4.6
parent 2ae43b3bcc
commit 331a4a4e88
442 changed files with 22226 additions and 18700 deletions
@@ -1,82 +1,104 @@
use axum::{Extension, Json, extract::{Path, Query}, response::IntoResponse};
use std::sync::Arc;
use uuid::Uuid;
use imphnen_utils::{errors::AppError, response_format::{ApiSuccess, ApiMessage}};
use super::dto::*;
use crate::middleware::hackathon_auth::HackathonAuthUser;
use crate::teams::domain::service::TeamService;
use super::dto::*;
use axum::{
Extension, Json,
extract::{Path, Query},
response::IntoResponse,
};
use imphnen_utils::{
errors::AppError,
response_format::{ApiMessage, ApiSuccess},
};
use std::sync::Arc;
use uuid::Uuid;
pub async fn create_team_handler(
Extension(service): Extension<Arc<dyn TeamService>>,
Extension(auth): Extension<HackathonAuthUser>,
Json(body): Json<CreateTeamRequest>,
Extension(service): Extension<Arc<dyn TeamService>>,
Extension(auth): Extension<HackathonAuthUser>,
Json(body): Json<CreateTeamRequest>,
) -> Result<axum::response::Response, AppError> {
let team = service.create_team(auth.user_id, body.into()).await?;
Ok(ApiSuccess(TeamResponse::from(team)).into_response())
let team = service.create_team(auth.user_id, body.into()).await?;
Ok(ApiSuccess(TeamResponse::from(team)).into_response())
}
pub async fn get_team_handler(
Extension(service): Extension<Arc<dyn TeamService>>,
Path(team_id): Path<Uuid>,
Extension(service): Extension<Arc<dyn TeamService>>,
Path(team_id): Path<Uuid>,
) -> Result<axum::response::Response, AppError> {
let team = service.get_team_by_id(team_id).await?;
Ok(ApiSuccess(TeamResponse::from(team)).into_response())
let team = service.get_team_by_id(team_id).await?;
Ok(ApiSuccess(TeamResponse::from(team)).into_response())
}
pub async fn browse_teams_handler(
Extension(service): Extension<Arc<dyn TeamService>>,
Query(query): Query<BrowseTeamsQuery>,
Extension(service): Extension<Arc<dyn TeamService>>,
Query(query): Query<BrowseTeamsQuery>,
) -> Result<axum::response::Response, AppError> {
let result = service.browse_teams(query.into()).await?;
Ok(ApiSuccess(TeamListResponse {
data: result.teams.into_iter().map(TeamResponse::from).collect(),
total: result.total,
page: result.page,
per_page: result.per_page,
}).into_response())
let result = service.browse_teams(query.into()).await?;
Ok(
ApiSuccess(TeamListResponse {
data: result.teams.into_iter().map(TeamResponse::from).collect(),
total: result.total,
page: result.page,
per_page: result.per_page,
})
.into_response(),
)
}
pub async fn get_my_teams_handler(
Extension(service): Extension<Arc<dyn TeamService>>,
Extension(auth): Extension<HackathonAuthUser>,
Extension(service): Extension<Arc<dyn TeamService>>,
Extension(auth): Extension<HackathonAuthUser>,
) -> Result<axum::response::Response, AppError> {
let teams = service.get_user_teams(auth.user_id).await?;
Ok(ApiSuccess(teams.into_iter().map(TeamResponse::from).collect::<Vec<_>>()).into_response())
let teams = service.get_user_teams(auth.user_id).await?;
Ok(
ApiSuccess(
teams
.into_iter()
.map(TeamResponse::from)
.collect::<Vec<_>>(),
)
.into_response(),
)
}
pub async fn update_team_handler(
Extension(service): Extension<Arc<dyn TeamService>>,
Extension(auth): Extension<HackathonAuthUser>,
Path(team_id): Path<Uuid>,
Json(body): Json<UpdateTeamRequest>,
Extension(service): Extension<Arc<dyn TeamService>>,
Extension(auth): Extension<HackathonAuthUser>,
Path(team_id): Path<Uuid>,
Json(body): Json<UpdateTeamRequest>,
) -> Result<axum::response::Response, AppError> {
let team = service.update_team(team_id, auth.user_id, body.into()).await?;
Ok(ApiSuccess(TeamResponse::from(team)).into_response())
let team = service
.update_team(team_id, auth.user_id, body.into())
.await?;
Ok(ApiSuccess(TeamResponse::from(team)).into_response())
}
pub async fn delete_team_handler(
Extension(service): Extension<Arc<dyn TeamService>>,
Extension(auth): Extension<HackathonAuthUser>,
Path(team_id): Path<Uuid>,
Extension(service): Extension<Arc<dyn TeamService>>,
Extension(auth): Extension<HackathonAuthUser>,
Path(team_id): Path<Uuid>,
) -> Result<axum::response::Response, AppError> {
service.delete_team(team_id, auth.user_id).await?;
Ok(ApiMessage::ok("Team deleted successfully").into_response())
service.delete_team(team_id, auth.user_id).await?;
Ok(ApiMessage::ok("Team deleted successfully").into_response())
}
pub async fn leave_team_handler(
Extension(service): Extension<Arc<dyn TeamService>>,
Extension(auth): Extension<HackathonAuthUser>,
Path(team_id): Path<Uuid>,
Extension(service): Extension<Arc<dyn TeamService>>,
Extension(auth): Extension<HackathonAuthUser>,
Path(team_id): Path<Uuid>,
) -> Result<axum::response::Response, AppError> {
service.leave_team(team_id, auth.user_id).await?;
Ok(ApiMessage::ok("Left team successfully").into_response())
service.leave_team(team_id, auth.user_id).await?;
Ok(ApiMessage::ok("Left team successfully").into_response())
}
pub async fn remove_member_handler(
Extension(service): Extension<Arc<dyn TeamService>>,
Extension(auth): Extension<HackathonAuthUser>,
Path((team_id, member_id)): Path<(Uuid, Uuid)>,
Extension(service): Extension<Arc<dyn TeamService>>,
Extension(auth): Extension<HackathonAuthUser>,
Path((team_id, member_id)): Path<(Uuid, Uuid)>,
) -> Result<axum::response::Response, AppError> {
service.remove_team_member(team_id, auth.user_id, member_id).await?;
Ok(ApiMessage::ok("Member removed successfully").into_response())
service
.remove_team_member(team_id, auth.user_id, member_id)
.await?;
Ok(ApiMessage::ok("Member removed successfully").into_response())
}