Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | 1x 1x 1x 1x 1x 1x 177x 177x 3x 3x 2x 1x 1x 1x 1x | 'use strict';
const Event = use('Event');
const Config = use('Config');
const Logger = use('Logger');
const CE = use('C2C/Exceptions');
const { deepMapKeysToCamel } = use('C2C/Helpers');
const { AUTH_ACCOUNT_CREATED_FAILED } = Config.get('modules.salon.constants');
class CreateAuthAccount {
static get inject() {
return ['AuthService'];
}
constructor(authService) {
this._authService = authService;
}
async execute(payload) {
try {
const signUpResult = await this._authService.signUpAccount(payload);
return deepMapKeysToCamel(signUpResult);
} catch (error) {
Event.fire(AUTH_ACCOUNT_CREATED_FAILED, payload);
Logger.info(
`Event emmited: ${AUTH_ACCOUNT_CREATED_FAILED}, payload: ${JSON.stringify(payload)}`,
);
throw CE.BadRequestException.raise('errors.createAuthAccountError');
}
}
}
module.exports = CreateAuthAccount;
|