fix: adapt services constructors

This commit is contained in:
yassinedorbozgithub 2025-01-09 08:28:14 +01:00
parent 816db9817a
commit 5bb4668a01
3 changed files with 4 additions and 4 deletions

View File

@ -39,10 +39,10 @@ export class InvitationService extends BaseService<
@Inject(InvitationRepository)
readonly repository: InvitationRepository,
@Inject(JwtService) private readonly jwtService: JwtService,
@Optional() private readonly mailerService: MailerService | undefined,
private logger: LoggerService,
protected readonly i18n: I18nService,
public readonly languageService: LanguageService,
@Optional() private readonly mailerService?: MailerService,
) {
super(repository);
}

View File

@ -32,11 +32,11 @@ import { UserService } from './user.service';
export class PasswordResetService {
constructor(
@Inject(JwtService) private readonly jwtService: JwtService,
@Optional() private readonly mailerService: MailerService | undefined,
private logger: LoggerService,
private readonly userService: UserService,
public readonly i18n: I18nService,
public readonly languageService: LanguageService,
@Optional() private readonly mailerService: MailerService,
) {}
public readonly jwtSignOptions: JwtSignOptions = {
@ -105,7 +105,7 @@ export class PasswordResetService {
// first step is to check if the token has been used
const user = await this.userService.findOne({ email: payload.email });
if (!user.resetToken || compareSync(user.resetToken, token)) {
if (!user?.resetToken || compareSync(user.resetToken, token)) {
throw new UnauthorizedException('Invalid token');
}

View File

@ -36,10 +36,10 @@ export class ValidateAccountService {
constructor(
@Inject(JwtService) private readonly jwtService: JwtService,
private readonly userService: UserService,
@Optional() private readonly mailerService: MailerService | undefined,
private logger: LoggerService,
private readonly i18n: I18nService,
private readonly languageService: LanguageService,
@Optional() private readonly mailerService?: MailerService,
) {}
/**