use async_trait::async_trait; use uuid::Uuid; use crate::{ error::CoreResult, models::{Album, Media, User}, }; #[async_trait] pub trait MediaRepository: Send + Sync { async fn find_by_hash(&self, hash: &str) -> CoreResult>; async fn create(&self, media: &Media) -> CoreResult<()>; async fn find_by_id(&self, id: Uuid) -> CoreResult>; async fn list_by_user(&self, user_id: Uuid) -> CoreResult>; async fn update_metadata( &self, id: Uuid, width: Option, height: Option, location: Option, ) -> CoreResult<()>; } #[async_trait] pub trait UserRepository: Send + Sync { async fn create(&self, user: User) -> CoreResult<()>; async fn find_by_email(&self, email: &str) -> CoreResult>; async fn find_by_username(&self, username: &str) -> CoreResult>; async fn find_by_id(&self, id: Uuid) -> CoreResult>; async fn update_storage_used(&self, user_id: Uuid, bytes: i64) -> CoreResult<()>; } #[async_trait] pub trait AlbumRepository: Send + Sync { async fn create(&self, album: Album) -> CoreResult<()>; async fn find_by_id(&self, id: Uuid) -> CoreResult>; async fn list_by_user(&self, user_id: Uuid) -> CoreResult>; async fn add_media_to_album(&self, album_id: Uuid, media_ids: &[Uuid]) -> CoreResult<()>; }