* Reject a join request
(id: string, handled_by_user_id: string, reason?: string)
| 139 | * Reject a join request |
| 140 | */ |
| 141 | async rejectRequest(id: string, handled_by_user_id: string, reason?: string): Promise<JoinRequest | null> { |
| 142 | const result = await query<JoinRequest>( |
| 143 | `UPDATE organization_join_requests |
| 144 | SET status = 'rejected', handled_by_user_id = $2, handled_at = NOW(), rejection_reason = $3, updated_at = NOW() |
| 145 | WHERE id = $1 AND status = 'pending' |
| 146 | RETURNING *`, |
| 147 | [id, handled_by_user_id, reason || null] |
| 148 | ); |
| 149 | |
| 150 | if (result.rows[0]) { |
| 151 | logger.info({ |
| 152 | requestId: id, |
| 153 | handledBy: handled_by_user_id, |
| 154 | reason |
| 155 | }, 'Join request rejected'); |
| 156 | } |
| 157 | |
| 158 | return result.rows[0] || null; |
| 159 | } |
| 160 | |
| 161 | /** |
| 162 | * Cancel a join request (by the user who made it) |
no outgoing calls
no test coverage detected