import { db } from "../db.js"; import { sessionManager } from "../whatsapp/session-manager.js"; import { syncGroupsForAccount } from "../whatsapp/group-sync.js"; import { pgNotifyWeb } from "./notify.js"; import { logger } from "../logger.js"; export async function handleSyncGroups(accountId: string): Promise { const session = sessionManager.getSession(accountId); if (!session) { logger.warn({ accountId }, "sync-groups: account not connected"); return; } const result = await syncGroupsForAccount(accountId, session.socket); await pgNotifyWeb({ type: "groups.synced", accountId, count: result.synced }); }