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,13 +1,13 @@
use std::sync::Arc;
use application::testing::InMemoryShareRepository;
use application::sharing::{
AccessSharedResourceQuery, AccessSharedResourceHandler,
GenerateShareLinkCommand, GenerateShareLinkHandler,
AccessSharedResourceHandler, AccessSharedResourceQuery, GenerateShareLinkCommand,
GenerateShareLinkHandler,
};
use application::testing::InMemoryShareRepository;
use chrono::{DateTime, Utc};
use domain::entities::{LinkAccessLevel, ShareableType};
use domain::errors::DomainError;
use domain::value_objects::{DateTimeStamp, SystemId};
use std::sync::Arc;
async fn create_link(
repo: &Arc<InMemoryShareRepository>,
@@ -15,14 +15,17 @@ async fn create_link(
max_uses: Option<u32>,
) -> String {
let handler = GenerateShareLinkHandler::new(repo.clone());
let (_, link) = handler.execute(GenerateShareLinkCommand {
shareable_type: ShareableType::Album,
shareable_id: SystemId::new(),
access_level: LinkAccessLevel::ViewOnly,
created_by: SystemId::new(),
expires_at,
max_uses,
}).await.unwrap();
let (_, link) = handler
.execute(GenerateShareLinkCommand {
shareable_type: ShareableType::Album,
shareable_id: SystemId::new(),
access_level: LinkAccessLevel::ViewOnly,
created_by: SystemId::new(),
expires_at,
max_uses,
})
.await
.unwrap();
link.token
}
@@ -32,9 +35,10 @@ async fn valid_link_returns_scope() {
let token = create_link(&repo, None, None).await;
let handler = AccessSharedResourceHandler::new(repo);
let (scope, access_level) = handler.execute(AccessSharedResourceQuery {
token,
}).await.unwrap();
let (scope, access_level) = handler
.execute(AccessSharedResourceQuery { token })
.await
.unwrap();
assert_eq!(access_level, LinkAccessLevel::ViewOnly);
assert_eq!(scope.shareable_type, ShareableType::Album);
@@ -59,7 +63,12 @@ async fn exhausted_link_rejected() {
// Use it once
let handler = AccessSharedResourceHandler::new(repo.clone());
handler.execute(AccessSharedResourceQuery { token: token.clone() }).await.unwrap();
handler
.execute(AccessSharedResourceQuery {
token: token.clone(),
})
.await
.unwrap();
// Second use should fail
let result = handler.execute(AccessSharedResourceQuery { token }).await;