* Check if user is a committee lead (handles both WorkOS and Slack user IDs)
(committeeId: string, userId: string)
| 311 | * Check if user is a committee lead (handles both WorkOS and Slack user IDs) |
| 312 | */ |
| 313 | async function isCommitteeLead(committeeId: string, userId: string): Promise<boolean> { |
| 314 | const pool = getPool(); |
| 315 | const result = await pool.query( |
| 316 | `SELECT 1 FROM working_group_leaders wgl |
| 317 | LEFT JOIN slack_user_mappings sm ON wgl.user_id = sm.slack_user_id AND sm.workos_user_id IS NOT NULL |
| 318 | WHERE wgl.working_group_id = $1 AND (wgl.user_id = $2 OR sm.workos_user_id = $2)`, |
| 319 | [committeeId, userId] |
| 320 | ); |
| 321 | return result.rows.length > 0; |
| 322 | } |
| 323 | |
| 324 | /** |
| 325 | * Get user info for author display |
no test coverage detected