style: cargo fmt --all

This commit is contained in:
2026-05-31 05:31:42 +02:00
parent 4b31a0f74b
commit c2ebca0da0
138 changed files with 2422 additions and 1164 deletions

View File

@@ -1,10 +1,7 @@
use std::sync::Arc;
use domain::{
entities::Album,
errors::DomainError,
ports::AlbumRepository,
value_objects::SystemId,
entities::Album, errors::DomainError, ports::AlbumRepository, value_objects::SystemId,
};
use std::sync::Arc;
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct CreateAlbumCommand {
@@ -23,7 +20,9 @@ impl CreateAlbumHandler {
pub async fn execute(&self, cmd: CreateAlbumCommand) -> Result<Album, DomainError> {
if cmd.title.is_empty() {
return Err(DomainError::Validation("Album title must not be empty".to_string()));
return Err(DomainError::Validation(
"Album title must not be empty".to_string(),
));
}
let album = Album::new(&cmd.title, cmd.creator_id);
self.album_repo.save(&album).await?;

View File

@@ -1,10 +1,7 @@
use std::sync::Arc;
use domain::{
entities::Album,
errors::DomainError,
ports::AlbumRepository,
value_objects::SystemId,
entities::Album, errors::DomainError, ports::AlbumRepository, value_objects::SystemId,
};
use std::sync::Arc;
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub enum AlbumAction {
@@ -29,7 +26,10 @@ impl ManageAlbumEntriesHandler {
}
pub async fn execute(&self, cmd: ManageAlbumEntriesCommand) -> Result<Album, DomainError> {
let mut album = self.album_repo.find_by_id(&cmd.album_id).await?
let mut album = self
.album_repo
.find_by_id(&cmd.album_id)
.await?
.ok_or_else(|| DomainError::NotFound(format!("Album {} not found", cmd.album_id)))?;
match cmd.action {

View File

@@ -1,10 +1,10 @@
use std::sync::Arc;
use domain::{
entities::{AssetTag, Tag},
errors::DomainError,
ports::{AssetRepository, TagRepository},
value_objects::SystemId,
};
use std::sync::Arc;
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct TagAssetCommand {
@@ -20,11 +20,16 @@ pub struct TagAssetHandler {
impl TagAssetHandler {
pub fn new(asset_repo: Arc<dyn AssetRepository>, tag_repo: Arc<dyn TagRepository>) -> Self {
Self { asset_repo, tag_repo }
Self {
asset_repo,
tag_repo,
}
}
pub async fn execute(&self, cmd: TagAssetCommand) -> Result<(Tag, AssetTag), DomainError> {
self.asset_repo.find_by_id(&cmd.asset_id).await?
self.asset_repo
.find_by_id(&cmd.asset_id)
.await?
.ok_or_else(|| DomainError::NotFound(format!("Asset {} not found", cmd.asset_id)))?;
let tag = match self.tag_repo.find_by_name(&cmd.tag_name).await? {

View File

@@ -1,7 +1,7 @@
pub mod commands;
pub mod queries;
pub use commands::{CreateAlbumCommand, CreateAlbumHandler};
pub use commands::{AlbumAction, ManageAlbumEntriesCommand, ManageAlbumEntriesHandler};
pub use commands::{CreateAlbumCommand, CreateAlbumHandler};
pub use commands::{TagAssetCommand, TagAssetHandler};
pub use queries::get_album::{GetAlbumQuery, GetAlbumHandler};
pub use queries::get_album::{GetAlbumHandler, GetAlbumQuery};

View File

@@ -1,10 +1,7 @@
use std::sync::Arc;
use domain::{
entities::Album,
errors::DomainError,
ports::AlbumRepository,
value_objects::SystemId,
entities::Album, errors::DomainError, ports::AlbumRepository, value_objects::SystemId,
};
use std::sync::Arc;
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct GetAlbumQuery {
@@ -21,7 +18,9 @@ impl GetAlbumHandler {
}
pub async fn execute(&self, query: GetAlbumQuery) -> Result<Album, DomainError> {
self.album_repo.find_by_id(&query.album_id).await?
self.album_repo
.find_by_id(&query.album_id)
.await?
.ok_or_else(|| DomainError::NotFound(format!("Album {} not found", query.album_id)))
}
}