refactor(nestjs): replace the reports endpoints

This commit is contained in:
Ahmed Bouhuolia
2025-05-09 18:55:16 +02:00
parent 3c8b7c92fe
commit 7506c2f37f
24 changed files with 82 additions and 62 deletions

View File

@@ -68,6 +68,7 @@ export class AuthController {
return this.authApp.signUpConfirm(email, token);
}
@Post('/send_reset_password')
@ApiOperation({ summary: 'Send reset password email' })
@ApiBody({

View File

@@ -16,10 +16,9 @@ export class AuthedController {
constructor(
private readonly getAuthedAccountService: GetAuthenticatedAccount,
private readonly authApp: AuthenticationApplication,
private readonly tenancyContext: TenancyContext,
) {}
@Post('/signup/confirm/resend')
@Post('/signup/verify/resend')
@ApiOperation({ summary: 'Resend the signup confirmation message' })
@ApiBody({
schema: {

View File

@@ -92,7 +92,10 @@ export class AuthSignupService {
const isEmailExists = await this.systemUserModel.query().findOne({ email });
if (isEmailExists) {
throw new ServiceError(ERRORS.EMAIL_EXISTS);
throw new ServiceError(
ERRORS.EMAIL_EXISTS,
'The given email address is already signed-up',
);
}
}
@@ -120,11 +123,17 @@ export class AuthSignupService {
);
if (!isAllowedEmail && !isAllowedDomain) {
throw new ServiceError(ERRORS.SIGNUP_RESTRICTED_NOT_ALLOWED);
throw new ServiceError(
ERRORS.SIGNUP_RESTRICTED_NOT_ALLOWED,
'The given email address format is not allowed to signup.',
);
}
// Throw error if the signup is disabled with no exceptions.
} else {
throw new ServiceError(ERRORS.SIGNUP_RESTRICTED);
throw new ServiceError(
ERRORS.SIGNUP_RESTRICTED,
'The sign-up is disabled',
);
}
}
}