@ -430,7 +430,7 @@ export class GroupSyncService {
for ( const group of groups ) {
const existing = this . dbInstance . prepare ( 'SELECT 1 FROM groups WHERE id = ?' ) . get ( ( group as EvolutionGroup ) . id ) ;
console . log ( 'Checking group:' , group . id , 'exists:' , ! ! existing ) ;
console . log ( 'Checking group:' , ( group as EvolutionGroup ) . id , 'exists:' , ! ! existing ) ;
const isCommunityFlag = ! ! ( ( ( group as any ) ? . isCommunity ) || ( ( group as any ) ? . is_community ) || ( ( group as any ) ? . isCommunityAnnounce ) || ( ( group as any ) ? . is_community_announce ) ) ;
@ -438,13 +438,13 @@ export class GroupSyncService {
const updateResult = this . dbInstance . prepare (
'UPDATE groups SET name = ?, community_id = COALESCE(?, community_id), is_community = ?, active = TRUE, last_verified = CURRENT_TIMESTAMP WHERE id = ?'
) . run ( ( group as EvolutionGroup ) . subject , ( group as EvolutionGroup ) . linkedParent || null , isCommunityFlag ? 1 : 0 , ( group as EvolutionGroup ) . id ) ;
console . log ( 'Updated group:' , group . id , 'result:' , updateResult ) ;
console . log ( 'Updated group:' , ( group as EvolutionGroup ) . id , 'result:' , updateResult ) ;
updated ++ ;
} else {
const insertResult = this . dbInstance . prepare (
'INSERT INTO groups (id, community_id, name, active, is_community) VALUES (?, ?, ?, TRUE, ?)'
) . run ( ( group as EvolutionGroup ) . id , ( ( ( group as EvolutionGroup ) . linkedParent ? ? '' ) ) , ( group as EvolutionGroup ) . subject , isCommunityFlag ? 1 : 0 ) ;
console . log ( 'Added group:' , group . id , 'result:' , insertResult ) ;
console . log ( 'Added group:' , ( group as EvolutionGroup ) . id , 'result:' , insertResult ) ;
added ++ ;
}
// Propagar subject a allowed_groups: