import { Inject } from '@nestjs/common' ; import { ICustomerRepository } from '../Repository/ICustomerRepository' ; import { Customer } from '../Customer.entity' ; export class IsCustomerAlreadyExist { constructor ( @ Inject ( 'ICustomerRepository' ) private readonly customerRepository ) { } public async isSatisfiedBy ( name ) { return ( ( await this . customerRepository . findOneByName ( name ) ) instanceof Customer ) ; } }