koprogo_api/application/ports/
poll_vote_repository.rs1use crate::domain::entities::PollVote;
2use async_trait::async_trait;
3use uuid::Uuid;
4
5#[async_trait]
6pub trait PollVoteRepository: Send + Sync {
7 async fn create(&self, vote: &PollVote) -> Result<PollVote, String>;
9
10 async fn find_by_id(&self, id: Uuid) -> Result<Option<PollVote>, String>;
12
13 async fn find_by_poll(&self, poll_id: Uuid) -> Result<Vec<PollVote>, String>;
15
16 async fn find_by_poll_and_owner(
18 &self,
19 poll_id: Uuid,
20 owner_id: Uuid,
21 ) -> Result<Option<PollVote>, String>;
22
23 async fn find_by_owner(&self, owner_id: Uuid) -> Result<Vec<PollVote>, String>;
25
26 async fn delete(&self, id: Uuid) -> Result<bool, String>;
28}