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,36 +1,42 @@
|
||||
use super::dto::*;
|
||||
use crate::chat::domain::service::ChatService;
|
||||
use crate::middleware::hackathon_auth::HackathonAuthUser;
|
||||
use axum::{Extension, Json, extract::Path, response::IntoResponse};
|
||||
use imphnen_utils::{
|
||||
errors::AppError,
|
||||
response_format::{ApiMessage, ApiSuccess},
|
||||
};
|
||||
use std::sync::Arc;
|
||||
use uuid::Uuid;
|
||||
use imphnen_utils::{errors::AppError, response_format::{ApiSuccess, ApiMessage}};
|
||||
use crate::middleware::hackathon_auth::HackathonAuthUser;
|
||||
use crate::chat::domain::service::ChatService;
|
||||
use super::dto::*;
|
||||
|
||||
pub async fn get_team_messages_handler(
|
||||
Extension(service): Extension<Arc<dyn ChatService>>,
|
||||
Extension(auth): Extension<HackathonAuthUser>,
|
||||
Path(team_id): Path<Uuid>,
|
||||
Extension(service): Extension<Arc<dyn ChatService>>,
|
||||
Extension(auth): Extension<HackathonAuthUser>,
|
||||
Path(team_id): Path<Uuid>,
|
||||
) -> Result<axum::response::Response, AppError> {
|
||||
let messages = service.get_team_messages(team_id, auth.user_id).await?;
|
||||
let response: Vec<MessageResponse> = messages.into_iter().map(MessageResponse::from).collect();
|
||||
Ok(ApiSuccess(response).into_response())
|
||||
let messages = service.get_team_messages(team_id, auth.user_id).await?;
|
||||
let response: Vec<MessageResponse> =
|
||||
messages.into_iter().map(MessageResponse::from).collect();
|
||||
Ok(ApiSuccess(response).into_response())
|
||||
}
|
||||
|
||||
pub async fn send_message_handler(
|
||||
Extension(service): Extension<Arc<dyn ChatService>>,
|
||||
Extension(auth): Extension<HackathonAuthUser>,
|
||||
Path(team_id): Path<Uuid>,
|
||||
Json(body): Json<SendMessageRequest>,
|
||||
Extension(service): Extension<Arc<dyn ChatService>>,
|
||||
Extension(auth): Extension<HackathonAuthUser>,
|
||||
Path(team_id): Path<Uuid>,
|
||||
Json(body): Json<SendMessageRequest>,
|
||||
) -> Result<axum::response::Response, AppError> {
|
||||
let message = service.send_message(team_id, auth.user_id, body.into()).await?;
|
||||
Ok(ApiSuccess(MessageResponse::from(message)).into_response())
|
||||
let message = service
|
||||
.send_message(team_id, auth.user_id, body.into())
|
||||
.await?;
|
||||
Ok(ApiSuccess(MessageResponse::from(message)).into_response())
|
||||
}
|
||||
|
||||
pub async fn delete_message_handler(
|
||||
Extension(service): Extension<Arc<dyn ChatService>>,
|
||||
Extension(auth): Extension<HackathonAuthUser>,
|
||||
Path(message_id): Path<Uuid>,
|
||||
Extension(service): Extension<Arc<dyn ChatService>>,
|
||||
Extension(auth): Extension<HackathonAuthUser>,
|
||||
Path(message_id): Path<Uuid>,
|
||||
) -> Result<axum::response::Response, AppError> {
|
||||
service.delete_message(message_id, auth.user_id).await?;
|
||||
Ok(ApiMessage::ok("Message deleted").into_response())
|
||||
service.delete_message(message_id, auth.user_id).await?;
|
||||
Ok(ApiMessage::ok("Message deleted").into_response())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user