Previously syncGroupsForAccount only upserted, so groups removed from WhatsApp (deleted, bot was kicked, etc.) lingered in the DB. Now compute the diff: any whatsapp_groups row for this account whose wa_group_jid is not in the live fetch result is deleted. Skip the delete sweep when the fetch returns empty — that's more likely transient than a genuine "every group gone" signal, and we don't want to nuke valid data on a hiccup. Return shape gains a `removed` count alongside `synced`.
Description
No description provided
Languages
TypeScript
97.8%
Shell
1.2%
Dockerfile
0.5%
CSS
0.5%