( email: string, accountId: string, authId: string )
| 260 | } |
| 261 | |
| 262 | export async function joinCommunity( |
| 263 | email: string, |
| 264 | accountId: string, |
| 265 | authId: string |
| 266 | ) { |
| 267 | const user = await findUser(accountId, authId); |
| 268 | if (!!user) { |
| 269 | await checkoutTenant(authId, accountId); |
| 270 | return { data: 'user already belongs to tenant' }; |
| 271 | } |
| 272 | const displayName = normalize(email.split('@').shift() || email); |
| 273 | const record = await createUser({ accountId, authId, displayName }); |
| 274 | await checkoutTenant(authId, accountId); |
| 275 | await createChannelMemberships(accountId, record.id); |
| 276 | } |
| 277 | |
| 278 | async function createUser({ |
| 279 | accountId, |
no test coverage detected