* Map a Slack user to a WorkOS user
(input: {
slack_user_id: string;
workos_user_id: string;
mapping_source: SlackMappingSource;
mapped_by_user_id?: string;
})
| 110 | * Map a Slack user to a WorkOS user |
| 111 | */ |
| 112 | async mapUser(input: { |
| 113 | slack_user_id: string; |
| 114 | workos_user_id: string; |
| 115 | mapping_source: SlackMappingSource; |
| 116 | mapped_by_user_id?: string; |
| 117 | }): Promise<SlackUserMapping | null> { |
| 118 | const result = await query<SlackUserMapping>( |
| 119 | `UPDATE slack_user_mappings |
| 120 | SET workos_user_id = $1, |
| 121 | mapping_status = 'mapped', |
| 122 | mapping_source = $2, |
| 123 | mapped_at = NOW(), |
| 124 | mapped_by_user_id = $3, |
| 125 | updated_at = NOW() |
| 126 | WHERE slack_user_id = $4 |
| 127 | RETURNING *`, |
| 128 | [ |
| 129 | input.workos_user_id, |
| 130 | input.mapping_source, |
| 131 | input.mapped_by_user_id || null, |
| 132 | input.slack_user_id, |
| 133 | ] |
| 134 | ); |
| 135 | return result.rows[0] || null; |
| 136 | } |
| 137 | |
| 138 | /** |
| 139 | * Unmap a Slack user from a WorkOS user |
no outgoing calls
no test coverage detected