()
| 141 | * Get sync status summary |
| 142 | */ |
| 143 | export async function getSyncStatus(): Promise<{ |
| 144 | configured: boolean; |
| 145 | stats: { |
| 146 | total: number; |
| 147 | mapped: number; |
| 148 | unmapped: number; |
| 149 | pending_verification: number; |
| 150 | bots: number; |
| 151 | deleted: number; |
| 152 | opted_out: number; |
| 153 | } | null; |
| 154 | last_sync: Date | null; |
| 155 | }> { |
| 156 | if (!isSlackConfigured()) { |
| 157 | return { |
| 158 | configured: false, |
| 159 | stats: null, |
| 160 | last_sync: null, |
| 161 | }; |
| 162 | } |
| 163 | |
| 164 | const stats = await slackDb.getStats(); |
| 165 | |
| 166 | // Get most recent sync timestamp |
| 167 | const mappings = await slackDb.getAllMappings({ limit: 1, includeBots: true, includeDeleted: true }); |
| 168 | const lastSync = mappings.length > 0 ? mappings[0].last_slack_sync_at : null; |
| 169 | |
| 170 | return { |
| 171 | configured: true, |
| 172 | stats, |
| 173 | last_sync: lastSync, |
| 174 | }; |
| 175 | } |
| 176 | |
| 177 | // ============== Working Group Member Sync ============== |
| 178 |
no test coverage detected