feat: enhance media management with EXIF data extraction, metadata filtering, and storage path generation
refactor: update configuration handling to use environment variables and improve code organization
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use libertas_core::{
|
||||
config::Config,
|
||||
config::{AppConfig},
|
||||
error::{CoreError, CoreResult},
|
||||
};
|
||||
use libertas_infra::factory::{
|
||||
build_album_repository, build_album_share_repository, build_database_pool,
|
||||
build_media_repository, build_user_repository,
|
||||
build_album_repository, build_album_share_repository, build_database_pool, build_media_metadata_repository, build_media_repository, build_user_repository
|
||||
};
|
||||
|
||||
use crate::{
|
||||
@@ -18,7 +17,7 @@ use crate::{
|
||||
state::AppState,
|
||||
};
|
||||
|
||||
pub async fn build_app_state(config: Config) -> CoreResult<AppState> {
|
||||
pub async fn build_app_state(config: AppConfig) -> CoreResult<AppState> {
|
||||
let nats_client = async_nats::connect(&config.broker_url)
|
||||
.await
|
||||
.map_err(|e| CoreError::Config(format!("Failed to connect to NATS: {}", e)))?;
|
||||
@@ -30,6 +29,8 @@ pub async fn build_app_state(config: Config) -> CoreResult<AppState> {
|
||||
let media_repo = build_media_repository(&config, db_pool.clone()).await?;
|
||||
let album_repo = build_album_repository(&config.database, db_pool.clone()).await?;
|
||||
let album_share_repo = build_album_share_repository(&config.database, db_pool.clone()).await?;
|
||||
let media_metadata_repo =
|
||||
build_media_metadata_repository(&config.database, db_pool.clone()).await?;
|
||||
|
||||
let hasher = Arc::new(Argon2Hasher::default());
|
||||
let tokenizer = Arc::new(JwtGenerator::new(config.jwt_secret.clone()));
|
||||
@@ -44,6 +45,7 @@ pub async fn build_app_state(config: Config) -> CoreResult<AppState> {
|
||||
media_repo.clone(),
|
||||
user_repo.clone(),
|
||||
album_share_repo.clone(),
|
||||
media_metadata_repo.clone(),
|
||||
config.clone(),
|
||||
nats_client.clone(),
|
||||
));
|
||||
|
||||
Reference in New Issue
Block a user