pub struct ResolutionUseCases { /* private fields */ }Implementations§
Source§impl ResolutionUseCases
impl ResolutionUseCases
pub fn new( resolution_repository: Arc<dyn ResolutionRepository>, vote_repository: Arc<dyn VoteRepository>, meeting_repository: Arc<dyn MeetingRepository>, unit_owner_repository: Arc<dyn UnitOwnerRepository>, unit_repository: Arc<dyn UnitRepository>, ) -> Self
Sourcepub async fn create_resolution(
&self,
meeting_id: Uuid,
title: String,
description: String,
resolution_type: ResolutionType,
majority_required: MajorityType,
agenda_item_index: Option<usize>,
) -> Result<Resolution, String>
pub async fn create_resolution( &self, meeting_id: Uuid, title: String, description: String, resolution_type: ResolutionType, majority_required: MajorityType, agenda_item_index: Option<usize>, ) -> Result<Resolution, String>
Create a new resolution for a meeting Enforces quorum validation per Art. 3.87 §5 CC before allowing resolution creation. Issue #310: Validates agenda_item_index if provided (Art. 3.87 CC - only agenda items can be voted on)
Sourcepub async fn get_resolution(
&self,
id: Uuid,
) -> Result<Option<Resolution>, String>
pub async fn get_resolution( &self, id: Uuid, ) -> Result<Option<Resolution>, String>
Get a resolution by ID
Sourcepub async fn get_meeting_resolutions(
&self,
meeting_id: Uuid,
) -> Result<Vec<Resolution>, String>
pub async fn get_meeting_resolutions( &self, meeting_id: Uuid, ) -> Result<Vec<Resolution>, String>
Get all resolutions for a meeting
Sourcepub async fn get_resolutions_by_status(
&self,
status: ResolutionStatus,
) -> Result<Vec<Resolution>, String>
pub async fn get_resolutions_by_status( &self, status: ResolutionStatus, ) -> Result<Vec<Resolution>, String>
Get resolutions by status
Sourcepub async fn update_resolution(
&self,
resolution: &Resolution,
) -> Result<Resolution, AppError>
pub async fn update_resolution( &self, resolution: &Resolution, ) -> Result<Resolution, AppError>
Update a resolution (only allowed if status is Pending).
Refuse aussi toute résolution générée d’office (Story 4.6, #581) : immuable quel que soit son statut — le syndic qu’elle évalue ne peut pas la réécrire.
Sourcepub async fn delete_resolution(&self, id: Uuid) -> Result<bool, AppError>
pub async fn delete_resolution(&self, id: Uuid) -> Result<bool, AppError>
Delete a resolution (only allowed if no votes have been cast).
Refuse aussi toute résolution générée d’office (Story 4.6, #581) — c’est le cœur de la story : le point évalue le syndic, il ne peut donc pas le retirer de l’ordre du jour.
Sourcepub async fn cast_vote(
&self,
resolution_id: Uuid,
owner_id: Uuid,
unit_id: Uuid,
vote_choice: VoteChoice,
proxy_owner_id: Option<Uuid>,
auth_method: Option<VoteAuthMethod>,
caller_owner_id: Uuid,
) -> Result<Vote, String>
pub async fn cast_vote( &self, resolution_id: Uuid, owner_id: Uuid, unit_id: Uuid, vote_choice: VoteChoice, proxy_owner_id: Option<Uuid>, auth_method: Option<VoteAuthMethod>, caller_owner_id: Uuid, ) -> Result<Vote, String>
Cast a vote on a resolution
caller_owner_id est le copropriétaire résolu depuis l’utilisateur
authentifié (#850) — jamais un identifiant repris tel quel du corps de
la requête. owner_id et proxy_owner_id, eux, restent ce que le
client envoie ; c’est précisément ce que ce cas d’usage vérifie
désormais contre caller_owner_id, plutôt que de les transmettre les
yeux fermés.
auth_method (Story 4.2, #48) est validé contre la modalité de l’AG :
absent → 422 (VOTE_AUTH_METHOD_REQUIRED), insuffisant pour un mode
remote/hybrid → 403 (VOTE_AUTH_INSUFFICIENT).
Sourcepub async fn change_vote(
&self,
vote_id: Uuid,
new_choice: VoteChoice,
) -> Result<Vote, String>
pub async fn change_vote( &self, vote_id: Uuid, new_choice: VoteChoice, ) -> Result<Vote, String>
Change a vote (if allowed by business rules)
Sourcepub async fn get_resolution_votes(
&self,
resolution_id: Uuid,
) -> Result<Vec<Vote>, String>
pub async fn get_resolution_votes( &self, resolution_id: Uuid, ) -> Result<Vec<Vote>, String>
Get all votes for a resolution
Sourcepub async fn get_owner_votes(&self, owner_id: Uuid) -> Result<Vec<Vote>, String>
pub async fn get_owner_votes(&self, owner_id: Uuid) -> Result<Vec<Vote>, String>
Get all votes by an owner
Sourcepub async fn close_voting(
&self,
resolution_id: Uuid,
total_voting_power: Decimal,
) -> Result<Resolution, String>
pub async fn close_voting( &self, resolution_id: Uuid, total_voting_power: Decimal, ) -> Result<Resolution, String>
Close voting on a resolution and calculate final result
Sourcepub async fn get_meeting_vote_summary(
&self,
meeting_id: Uuid,
) -> Result<Vec<Resolution>, String>
pub async fn get_meeting_vote_summary( &self, meeting_id: Uuid, ) -> Result<Vec<Resolution>, String>
Get vote summary for a meeting (all resolutions with their results)
Sourcepub async fn has_unit_voted(
&self,
resolution_id: Uuid,
unit_id: Uuid,
) -> Result<bool, String>
pub async fn has_unit_voted( &self, resolution_id: Uuid, unit_id: Uuid, ) -> Result<bool, String>
Check if a unit has voted on a resolution
Sourcepub async fn get_vote_statistics(
&self,
resolution_id: Uuid,
) -> Result<VoteStatistics, String>
pub async fn get_vote_statistics( &self, resolution_id: Uuid, ) -> Result<VoteStatistics, String>
Get vote statistics for a resolution
Auto Trait Implementations§
impl !RefUnwindSafe for ResolutionUseCases
impl !UnwindSafe for ResolutionUseCases
impl Freeze for ResolutionUseCases
impl Send for ResolutionUseCases
impl Sync for ResolutionUseCases
impl Unpin for ResolutionUseCases
impl UnsafeUnpin for ResolutionUseCases
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
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>
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>
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 more