({
request,
response,
communityId,
authId,
displayName,
profileImageUrl,
}: {
request: any;
response: any;
communityId: string;
authId: string;
displayName: string;
profileImageUrl?: string;
})
| 316 | } |
| 317 | |
| 318 | export async function joinCommunityAfterSignIn({ |
| 319 | request, |
| 320 | response, |
| 321 | communityId, |
| 322 | authId, |
| 323 | displayName, |
| 324 | profileImageUrl, |
| 325 | }: { |
| 326 | request: any; |
| 327 | response: any; |
| 328 | communityId: string; |
| 329 | authId: string; |
| 330 | displayName: string; |
| 331 | profileImageUrl?: string; |
| 332 | }) { |
| 333 | const permissions = await PermissionsService.get({ |
| 334 | request, |
| 335 | response, |
| 336 | params: { communityId }, |
| 337 | }); |
| 338 | |
| 339 | if (!permissions.access) { |
| 340 | throw new Unauthorized(); |
| 341 | } |
| 342 | await checkoutTenant(authId, communityId); |
| 343 | const record = await findUser(communityId, authId); |
| 344 | if (record) { |
| 345 | return record; |
| 346 | } |
| 347 | const user = await createUser({ |
| 348 | accountId: communityId, |
| 349 | authId, |
| 350 | displayName, |
| 351 | profileImageUrl, |
| 352 | }); |
| 353 | await createChannelMemberships(communityId, user.id); |
| 354 | return user; |
| 355 | } |
| 356 | |
| 357 | export async function inviteNewMembers({ |
| 358 | emails = [], |
no test coverage detected