File tree Expand file tree Collapse file tree
packages/stream_chat_persistence/lib/src/dao Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -60,33 +60,6 @@ class PollVoteDao extends DatabaseAccessor<DriftChatDatabase> with _$PollVoteDao
6060 return grouped;
6161 }
6262
63- /// Returns poll votes for every id in [pollIds] , grouped by poll id.
64- Future <Map <String , List <PollVote >>> getPollVotesForPolls (
65- List <String > pollIds,
66- ) async {
67- if (pollIds.isEmpty) return const {};
68- final grouped = < String , List <PollVote >> {
69- for (final id in pollIds) id: < PollVote > [],
70- };
71- for (final chunk in chunked (pollIds)) {
72- final where = pollVotes.pollId.isIn (chunk);
73- final rows = await (select (pollVotes).join ([
74- leftOuterJoin (users, pollVotes.userId.equalsExp (users.id)),
75- ])
76- ..where (where)
77- ..orderBy ([OrderingTerm .asc (pollVotes.createdAt)]))
78- .map ((row) {
79- final userEntity = row.readTableOrNull (users);
80- final pollVoteEntity = row.readTable (pollVotes);
81- return pollVoteEntity.toPollVote (user: userEntity? .toUser ());
82- }).get ();
83- for (final v in rows) {
84- grouped[v.pollId]! .add (v);
85- }
86- }
87- return grouped;
88- }
89-
9063 /// Updates the poll votes data with the new [pollVoteList] data
9164 Future <void > updatePollVotes (List <PollVote > pollVoteList) => batch (
9265 (it) => it.insertAllOnConflictUpdate (
You can’t perform that action at this time.
0 commit comments