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,11 +1,15 @@
|
||||
#![allow(clippy::all)]
|
||||
|
||||
use std::error::Error;
|
||||
use chrono::Utc;
|
||||
use imphnen_entities::seaorm::common::events::{
|
||||
ActiveModel as EventsActiveModel, Entity as EventEntity,
|
||||
};
|
||||
use imphnen_libs::postgres::{PostgresConfig, PostgresConnection};
|
||||
use imphnen_entities::seaorm::common::events::{ActiveModel as EventsActiveModel, Entity as EventEntity};
|
||||
use sea_orm::{ActiveValue::Set, ActiveModelTrait, EntityTrait, ColumnTrait, QueryFilter};
|
||||
use sea_orm::{
|
||||
ActiveModelTrait, ActiveValue::Set, ColumnTrait, EntityTrait, QueryFilter,
|
||||
};
|
||||
use std::error::Error;
|
||||
use uuid::Uuid;
|
||||
use chrono::Utc; // Removed NaiveDateTime as it was unused
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn Error>> {
|
||||
@@ -54,7 +58,6 @@ async fn main() -> Result<(), Box<dyn Error>> {
|
||||
"2025-09-20T13:00:00Z",
|
||||
"2025-09-22T15:00:00Z",
|
||||
),
|
||||
// Additional Events
|
||||
(
|
||||
"Rust Programming Bootcamp",
|
||||
"Intensive 3-day bootcamp to master Rust fundamentals and advanced concepts.",
|
||||
@@ -154,18 +157,20 @@ async fn main() -> Result<(), Box<dyn Error>> {
|
||||
price,
|
||||
location,
|
||||
is_online,
|
||||
start_date_str, // Renamed to avoid conflict
|
||||
end_date_str, // Renamed to avoid conflict
|
||||
start_date_str,
|
||||
end_date_str,
|
||||
) in events
|
||||
{
|
||||
// Check if event already exists by name
|
||||
let existing = EventEntity::find().filter(<EventEntity as EntityTrait>::Column::Name.eq(name)).one(db).await?;
|
||||
let existing = EventEntity::find()
|
||||
.filter(<EventEntity as EntityTrait>::Column::Name.eq(name))
|
||||
.one(db)
|
||||
.await?;
|
||||
if existing.is_some() {
|
||||
println!("ℹ️ Skipping (already exists): {name}");
|
||||
continue;
|
||||
}
|
||||
|
||||
let uuid = Uuid::new_v4(); // Generate a Uuid
|
||||
let uuid = Uuid::new_v4();
|
||||
let mut event_model: EventsActiveModel = Default::default();
|
||||
event_model.id = Set(uuid);
|
||||
event_model.name = Set(name.to_string());
|
||||
@@ -174,12 +179,17 @@ async fn main() -> Result<(), Box<dyn Error>> {
|
||||
event_model.price = Set(price);
|
||||
event_model.is_online = Set(is_online);
|
||||
event_model.location = Set(location.clone());
|
||||
event_model.start_date = Set(chrono::DateTime::parse_from_rfc3339(start_date_str)?.with_timezone(&chrono::Utc));
|
||||
event_model.end_date = Set(chrono::DateTime::parse_from_rfc3339(end_date_str)?.with_timezone(&chrono::Utc));
|
||||
event_model.is_deleted = Set(false); // Explicitly set is_deleted
|
||||
event_model.created_at = Set(Utc::now()); // Explicitly set created_at
|
||||
event_model.updated_at = Set(Utc::now()); // Explicitly set updated_at
|
||||
|
||||
event_model.start_date = Set(
|
||||
chrono::DateTime::parse_from_rfc3339(start_date_str)?
|
||||
.with_timezone(&chrono::Utc),
|
||||
);
|
||||
event_model.end_date = Set(
|
||||
chrono::DateTime::parse_from_rfc3339(end_date_str)?
|
||||
.with_timezone(&chrono::Utc),
|
||||
);
|
||||
event_model.is_deleted = Set(false);
|
||||
event_model.created_at = Set(Utc::now());
|
||||
event_model.updated_at = Set(Utc::now());
|
||||
|
||||
event_model.insert(db).await?;
|
||||
|
||||
@@ -192,4 +202,4 @@ async fn main() -> Result<(), Box<dyn Error>> {
|
||||
|
||||
println!("✅ All Events seeded");
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user