pub struct PostgresAcpRepository { /* private fields */ }Implementations§
Trait Implementations§
Source§impl AcpRepository for PostgresAcpRepository
impl AcpRepository for PostgresAcpRepository
Source§fn count_buildings<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<i64, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn count_buildings<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<i64, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Nombre d’immeubles rattachés à cette ACP.
Le corps précédent renvoyait Ok(0) en dur, avec ce commentaire :
« Story 1.1 : la colonne buildings.acp_id n’existe pas encore
(Story 1.2) ». Le commentaire était périmé — la colonne existe depuis
la migration 20260601020000, et elle est même NOT NULL depuis
20260601040000. Le garde-fou était donc en façade, et personne ne
l’appelait.
Conséquence : archive() faisait un DELETE FROM acps nu contre une
clé étrangère en NO ACTION, ce qui remontait une violation SQL en
AppError::Database — soit un 500 à l’utilisateur pour ce qui est
une règle métier parfaitement légitime.
Source§fn create<'life0, 'life1, 'async_trait>(
&'life0 self,
acp: &'life1 Acp,
) -> Pin<Box<dyn Future<Output = Result<Acp, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create<'life0, 'life1, 'async_trait>(
&'life0 self,
acp: &'life1 Acp,
) -> Pin<Box<dyn Future<Output = Result<Acp, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Persiste une nouvelle ACP. Retourne l’entité telle que stockée
(incl.
created_at / updated_at côté DB si différents).Source§fn find_by_id<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<Acp>, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn find_by_id<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<Acp>, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Récupère par id.
None si absent (pas une erreur).Source§fn find_by_id_with_metrics<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<(Acp, AcpMetrics)>, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn find_by_id_with_metrics<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<(Acp, AcpMetrics)>, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Story H6 (CL1) — récupère l’ACP avec ses métriques agrégées (Σ units,
Σ lots déclarés, Σ quotités, nb blocs) sur TOUS ses buildings. Source
de vérité de la conformité ACP-level (
Acp::assert_conformant, ADR-0010).
None si l’ACP n’existe pas.Source§fn list_with_metrics<'life0, 'async_trait>(
&'life0 self,
scope: ListScope,
) -> Pin<Box<dyn Future<Output = Result<Vec<(Acp, AcpMetrics)>, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_with_metrics<'life0, 'async_trait>(
&'life0 self,
scope: ListScope,
) -> Pin<Box<dyn Future<Output = Result<Vec<(Acp, AcpMetrics)>, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
La même liste, avec les métriques de chaque ACP. Read more
Source§fn list<'life0, 'async_trait>(
&'life0 self,
scope: ListScope,
) -> Pin<Box<dyn Future<Output = Result<Vec<Acp>, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list<'life0, 'async_trait>(
&'life0 self,
scope: ListScope,
) -> Pin<Box<dyn Future<Output = Result<Vec<Acp>, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Liste filtrée par scope. Tri implémentation :
created_at DESC.Source§fn update<'life0, 'life1, 'async_trait>(
&'life0 self,
acp: &'life1 Acp,
) -> Pin<Box<dyn Future<Output = Result<Acp, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update<'life0, 'life1, 'async_trait>(
&'life0 self,
acp: &'life1 Acp,
) -> Pin<Box<dyn Future<Output = Result<Acp, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Met à jour une ACP existante (UPDATE … WHERE id = $1).
Retourne
AppError::NotFound si aucune ligne affectée.Source§fn archive<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<(), AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn archive<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<(), AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
“Archive” = DELETE physique pour cette Story 1.1 (pas de soft-delete
en v0.1.0 sur cette table ; la story 5.1 introduira
archived_at sur
acp_enabled_modules, pas ici). Retourne Ok(()) si suppression OK,
AppError::NotFound si aucune ligne affectée.Auto Trait Implementations§
impl !RefUnwindSafe for PostgresAcpRepository
impl !UnwindSafe for PostgresAcpRepository
impl Freeze for PostgresAcpRepository
impl Send for PostgresAcpRepository
impl Sync for PostgresAcpRepository
impl Unpin for PostgresAcpRepository
impl UnsafeUnpin for PostgresAcpRepository
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.