pub struct PortfolioUseCases { /* private fields */ }Implementations§
Source§impl PortfolioUseCases
impl PortfolioUseCases
pub fn new( repository: Arc<dyn PortfolioRepository>, building_repository: Arc<dyn BuildingRepository>, user_repository: Arc<dyn UserRepository>, ) -> Self
Sourcepub async fn create_portfolio(
&self,
caller: &PortfolioCaller,
dto: CreatePortfolioDto,
) -> Result<PortfolioResponseDto, AppError>
pub async fn create_portfolio( &self, caller: &PortfolioCaller, dto: CreatePortfolioDto, ) -> Result<PortfolioResponseDto, AppError>
Crée un portfolio pour le caller.
Sourcepub async fn get_portfolio(
&self,
caller: &PortfolioCaller,
id: Uuid,
) -> Result<PortfolioResponseDto, AppError>
pub async fn get_portfolio( &self, caller: &PortfolioCaller, id: Uuid, ) -> Result<PortfolioResponseDto, AppError>
Récupère un portfolio par id (owner OU shared).
Sourcepub async fn list_portfolios(
&self,
caller: &PortfolioCaller,
) -> Result<Vec<PortfolioResponseDto>, AppError>
pub async fn list_portfolios( &self, caller: &PortfolioCaller, ) -> Result<Vec<PortfolioResponseDto>, AppError>
Liste les portfolios visibles pour le caller.
Sourcepub async fn update_portfolio(
&self,
caller: &PortfolioCaller,
id: Uuid,
dto: UpdatePortfolioDto,
) -> Result<PortfolioResponseDto, AppError>
pub async fn update_portfolio( &self, caller: &PortfolioCaller, id: Uuid, dto: UpdatePortfolioDto, ) -> Result<PortfolioResponseDto, AppError>
Met à jour un portfolio (owner OU shared can_edit).
Sourcepub async fn delete_portfolio(
&self,
caller: &PortfolioCaller,
id: Uuid,
) -> Result<(), AppError>
pub async fn delete_portfolio( &self, caller: &PortfolioCaller, id: Uuid, ) -> Result<(), AppError>
Supprime un portfolio (owner only).
Sourcepub async fn add_building(
&self,
caller: &PortfolioCaller,
portfolio_id: Uuid,
dto: AddBuildingDto,
) -> Result<PortfolioBuildingResponseDto, AppError>
pub async fn add_building( &self, caller: &PortfolioCaller, portfolio_id: Uuid, dto: AddBuildingDto, ) -> Result<PortfolioBuildingResponseDto, AppError>
Ajoute un building au portfolio (owner OU shared can_edit).
Sourcepub async fn remove_building(
&self,
caller: &PortfolioCaller,
portfolio_id: Uuid,
building_id: Uuid,
) -> Result<(), AppError>
pub async fn remove_building( &self, caller: &PortfolioCaller, portfolio_id: Uuid, building_id: Uuid, ) -> Result<(), AppError>
Retire un building du portfolio (owner OU shared can_edit).
Sourcepub async fn list_buildings(
&self,
caller: &PortfolioCaller,
portfolio_id: Uuid,
) -> Result<Vec<PortfolioBuildingResponseDto>, AppError>
pub async fn list_buildings( &self, caller: &PortfolioCaller, portfolio_id: Uuid, ) -> Result<Vec<PortfolioBuildingResponseDto>, AppError>
Liste les buildings d’un portfolio (owner OU shared).
Tri : favoris d’abord puis added_at DESC (cf. AC @happy Story 2.1).
Partage le portfolio avec un autre user (owner only).
Retire un partage (owner only).
Liste les partages d’un portfolio (owner only).
Auto Trait Implementations§
impl !RefUnwindSafe for PortfolioUseCases
impl !UnwindSafe for PortfolioUseCases
impl Freeze for PortfolioUseCases
impl Send for PortfolioUseCases
impl Sync for PortfolioUseCases
impl Unpin for PortfolioUseCases
impl UnsafeUnpin for PortfolioUseCases
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Fake for T
impl<T> Fake for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.