feat(persistence): add support for polls and poll votes #2060
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request includes several changes to the
stream_chat
package, focusing on adding support for polls and poll votes. The most important changes include adding new methods for handling polls and poll votes, updating data access objects (DAOs) to support these new entities, and integrating these changes throughout the codebase.Poll and Poll Vote Support:
packages/stream_chat/lib/src/core/models/poll.dart
: Added@JsonValue
annotations to theVotingVisibility
enum to support serialization.packages/stream_chat/lib/src/core/models/poll_vote.dart
: Added acopyWith
method to thePollVote
class to facilitate creating modified copies of poll votes.Data Access Objects (DAOs) Updates:
packages/stream_chat_persistence/lib/src/dao/poll_dao.dart
: Created a newPollDao
class for managing poll entities, including methods for retrieving, updating, and deleting polls.packages/stream_chat_persistence/lib/src/dao/poll_vote_dao.dart
: Created a newPollVoteDao
class for managing poll vote entities, including methods for retrieving, updating, and deleting poll votes.Integration with Chat Persistence:
packages/stream_chat/lib/src/db/chat_persistence_client.dart
: Added methods to theChatPersistenceClient
class for updating and deleting polls and poll votes, and integrated these methods into the existing data handling logic. [1] [2] [3] [4] [5] [6]Testing and Converters:
packages/stream_chat_persistence/lib/src/converter/voting_visibility_converter.dart
: Added aVotingVisibilityConverter
class to handle the conversion ofVotingVisibility
enum values to and from strings for database storage.packages/stream_chat/test/src/db/chat_persistence_client_test.dart
: Updated the test persistence client and added new tests to cover the new poll and poll vote methods. [1] [2] [3] [4] [5]