pub struct PollUseCases { /* private fields */ }Implementations§
Source§impl PollUseCases
impl PollUseCases
pub fn new( poll_repository: Arc<dyn PollRepository>, poll_vote_repository: Arc<dyn PollVoteRepository>, owner_repository: Arc<dyn OwnerRepository>, unit_owner_repository: Arc<dyn UnitOwnerRepository>, ) -> Self
Sourcepub async fn create_poll(
&self,
dto: CreatePollDto,
created_by: Uuid,
) -> Result<PollResponseDto, String>
pub async fn create_poll( &self, dto: CreatePollDto, created_by: Uuid, ) -> Result<PollResponseDto, String>
Create a new poll (draft status)
Sourcepub async fn update_poll(
&self,
poll_id: Uuid,
dto: UpdatePollDto,
user_id: Uuid,
) -> Result<PollResponseDto, String>
pub async fn update_poll( &self, poll_id: Uuid, dto: UpdatePollDto, user_id: Uuid, ) -> Result<PollResponseDto, String>
Update an existing poll (only if in draft status)
Sourcepub async fn list_polls_paginated(
&self,
page_request: &PageRequest,
filters: &PollFilters,
) -> Result<PollListResponseDto, String>
pub async fn list_polls_paginated( &self, page_request: &PageRequest, filters: &PollFilters, ) -> Result<PollListResponseDto, String>
List polls with pagination and filters
Sourcepub async fn find_active_polls(
&self,
building_id: Uuid,
) -> Result<Vec<PollResponseDto>, String>
pub async fn find_active_polls( &self, building_id: Uuid, ) -> Result<Vec<PollResponseDto>, String>
Find active polls for a building
Sourcepub async fn publish_poll(
&self,
poll_id: Uuid,
user_id: Uuid,
) -> Result<PollResponseDto, String>
pub async fn publish_poll( &self, poll_id: Uuid, user_id: Uuid, ) -> Result<PollResponseDto, String>
Publish a draft poll (change status to Active)
Sourcepub async fn close_poll(
&self,
poll_id: Uuid,
user_id: Uuid,
) -> Result<PollResponseDto, String>
pub async fn close_poll( &self, poll_id: Uuid, user_id: Uuid, ) -> Result<PollResponseDto, String>
Close a poll manually
Sourcepub async fn cancel_poll(
&self,
poll_id: Uuid,
user_id: Uuid,
) -> Result<PollResponseDto, String>
pub async fn cancel_poll( &self, poll_id: Uuid, user_id: Uuid, ) -> Result<PollResponseDto, String>
Cancel a poll
Sourcepub async fn delete_poll(
&self,
poll_id: Uuid,
user_id: Uuid,
) -> Result<bool, String>
pub async fn delete_poll( &self, poll_id: Uuid, user_id: Uuid, ) -> Result<bool, String>
Delete a poll (only if in draft or cancelled status)
Sourcepub async fn cast_vote(
&self,
dto: CastVoteDto,
owner_id: Option<Uuid>,
) -> Result<String, String>
pub async fn cast_vote( &self, dto: CastVoteDto, owner_id: Option<Uuid>, ) -> Result<String, String>
Cast a vote on a poll
Sourcepub async fn get_poll_results(
&self,
poll_id: Uuid,
) -> Result<PollResultsDto, String>
pub async fn get_poll_results( &self, poll_id: Uuid, ) -> Result<PollResultsDto, String>
Get poll results
Sourcepub async fn get_building_statistics(
&self,
building_id: Uuid,
) -> Result<PollStatistics, String>
pub async fn get_building_statistics( &self, building_id: Uuid, ) -> Result<PollStatistics, String>
Get poll statistics for a building
Sourcepub async fn auto_close_expired_polls(&self) -> Result<usize, String>
pub async fn auto_close_expired_polls(&self) -> Result<usize, String>
Find and auto-close expired polls (for background job)
Auto Trait Implementations§
impl Freeze for PollUseCases
impl !RefUnwindSafe for PollUseCases
impl Send for PollUseCases
impl Sync for PollUseCases
impl Unpin for PollUseCases
impl !UnwindSafe for PollUseCases
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<T> Chain<T> for T
impl<T> Chain<T> for T
§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.