PollMessageDAOImpl

internal class PollMessageDAOImpl(pollContentQueries: PollContentQueries, readDispatcher: ReadDispatcher, writeDispatcher: WriteDispatcher) : PollMessageDAO

Constructors

Link copied to clipboard
internal constructor(pollContentQueries: PollContentQueries, readDispatcher: ReadDispatcher, writeDispatcher: WriteDispatcher)

Functions

Link copied to clipboard
open suspend override fun getVote(conversationId: QualifiedIDEntity, pollMessageId: String, voterId: QualifiedIDEntity): PollVoteEntity?
Link copied to clipboard
open suspend override 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
open suspend override 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.