PollMessageDAO
Functions
Link copied to clipboard
abstract suspend fun getVote(conversationId: QualifiedIDEntity, pollMessageId: String, voterId: QualifiedIDEntity): PollVoteEntity?
Link copied to clipboard
abstract suspend fun recordVote(conversationId: QualifiedIDEntity, pollMessageId: String, vote: PollVoteEntity): Boolean
Stores vote as the voter's current selection when the poll exists and the selection is valid for it: every option belongs to the poll, and a single-answer poll has at most one option. Repeated options are removed. Returns false without storing anything otherwise. A vote older than the stored one is ignored but still valid.
Link copied to clipboard
abstract suspend fun revertVote(conversationId: QualifiedIDEntity, pollMessageId: String, failedVote: PollVoteEntity, previousVote: PollVoteEntity?)
Replaces failedVote with previousVote, or removes it when there was no previous vote. Does nothing when a newer vote has replaced failedVote in the meantime.