import { Inject } from '@nestjs/common' ; import { ITaskRepository } from '../Repository/ITaskRepository' ; import { Task } from '../Task.entity' ; export class IsTaskAlreadyExist { constructor ( @ Inject ( 'ITaskRepository' ) private readonly taskRepository ) { } public async isSatisfiedBy ( name ) { return ( await this . taskRepository . findOneByName ( name ) ) instanceof Task ; } }