import { Inject } from '@nestjs/common' ; import { IUserRepository } from '../Repository/IUserRepository' ; import { User } from '../User.entity' ; export class IsEmailAlreadyExist { constructor ( @ Inject ( 'IUserRepository' ) private readonly userRepository ) { } public async isSatisfiedBy ( email ) { return ( await this . userRepository . findOneByEmail ( email ) ) instanceof User ; } }