in services/application/apps/user/src/users/users.service.ts [16:43]
async create(
tenantId: string,
userPoolId: string,
createUserDto: CreateUserDto,
) {
try {
const client = new CognitoIdentityProviderClient({
region: process.env.AWS_REGION,
});
const cmd = new AdminCreateUserCommand({
UserPoolId: userPoolId,
Username: createUserDto.email,
UserAttributes: [{ Name: 'custom:tenant-id', Value: tenantId }],
});
await client.send(cmd);
return JSON.stringify('success');
} catch (error) {
console.error(error);
throw new HttpException(
{
status: HttpStatus.INTERNAL_SERVER_ERROR,
error: error,
},
HttpStatus.INTERNAL_SERVER_ERROR,
);
}
return null;
}