File tree Expand file tree Collapse file tree 3 files changed +10
-2
lines changed
src/api/integrations/channel/whatsapp Expand file tree Collapse file tree 3 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -127,6 +127,7 @@ model Chat {
127127 unreadMessages Int @default (0 )
128128 @@index ([instanceId ] )
129129 @@index ([remoteJid ] )
130+ @@unique ([remoteJid , instanceId ] )
130131}
131132
132133model Contact {
Original file line number Diff line number Diff line change @@ -127,6 +127,7 @@ model Chat {
127127 unreadMessages Int @default (0 )
128128 @@index ([instanceId ] )
129129 @@index ([remoteJid ] )
130+ @@unique ([remoteJid , instanceId ] )
130131}
131132
132133model Contact {
Original file line number Diff line number Diff line change @@ -1147,7 +1147,10 @@ export class BaileysStartupService extends ChannelStartupService {
11471147
11481148 this . sendDataWebhook ( Events . CHATS_UPSERT , [ chatToInsert ] ) ;
11491149 if ( this . configService . get < Database > ( 'DATABASE' ) . SAVE_DATA . CHATS ) {
1150- await this . prismaRepository . chat . create ( {
1150+ await this . prismaRepository . chat . update ( {
1151+ where : {
1152+ id : existingChat . id ,
1153+ } ,
11511154 data : chatToInsert ,
11521155 } ) ;
11531156 }
@@ -1483,7 +1486,10 @@ export class BaileysStartupService extends ChannelStartupService {
14831486
14841487 this . sendDataWebhook ( Events . CHATS_UPSERT , [ chatToInsert ] ) ;
14851488 if ( this . configService . get < Database > ( 'DATABASE' ) . SAVE_DATA . CHATS ) {
1486- await this . prismaRepository . chat . create ( {
1489+ await this . prismaRepository . chat . update ( {
1490+ where : {
1491+ id : existingChat . id ,
1492+ } ,
14871493 data : chatToInsert ,
14881494 } ) ;
14891495 }
You can’t perform that action at this time.
0 commit comments