File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed
Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -30,11 +30,7 @@ export const updateMessage = ({
3030 return queries ;
3131 }
3232
33- const { poll, poll_id } = messages [ 0 ] ;
34-
3533 const storableMessage = mapMessageToStorable ( {
36- ...( poll ? { poll : JSON . parse ( poll ) } : { } ) ,
37- ...( poll_id ? { poll_id } : { } ) ,
3834 ...message ,
3935 } ) ;
4036
Original file line number Diff line number Diff line change 11import type { PollResponse } from 'stream-chat' ;
22
33import { mapPollToStorable } from '../mappers/mapPollToStorable' ;
4+ import { mapStorableToPoll } from '../mappers/mapStorableToPoll' ;
45import { QuickSqliteClient } from '../QuickSqliteClient' ;
56import { createSelectQuery } from '../sqlite-utils/createSelectQuery' ;
67import { createUpdateQuery } from '../sqlite-utils/createUpdateQuery' ;
@@ -23,14 +24,17 @@ export const updatePollMessage = ({
2324 ) ;
2425
2526 for ( const pollFromDB of pollsFromDB ) {
26- const { latest_votes, own_votes } = pollFromDB ;
27+ const serializedPoll = mapStorableToPoll ( pollFromDB ) ;
28+ const { latest_votes, own_votes } = serializedPoll ;
2729 console . log ( own_votes ) ;
2830 const storablePoll = mapPollToStorable ( {
29- ...pollFromDB ,
30- latest_votes : latest_votes ? JSON . parse ( latest_votes ) : [ ] ,
31- own_votes : own_votes ? JSON . parse ( own_votes ) : [ ] ,
31+ ...poll ,
32+ // latest_votes: latest_votes ?? [],
33+ // own_votes: own_votes ?? [],
3234 } ) ;
3335
36+ console . log ( 'STORABLE POLL: ' , storablePoll ) ;
37+
3438 queries . push (
3539 createUpdateQuery ( 'poll' , storablePoll , {
3640 id : poll . id ,
You can’t perform that action at this time.
0 commit comments