Skip to content

Instantly share code, notes, and snippets.

@paulodutra
Created August 12, 2024 01:58
Show Gist options
  • Save paulodutra/c6c8dde2968acc95241789ba8d48ef09 to your computer and use it in GitHub Desktop.
Save paulodutra/c6c8dde2968acc95241789ba8d48ef09 to your computer and use it in GitHub Desktop.
Method that called the repository
import { Injectable } from '@nestjs/common';
import { TaskRepository } from '@/infrastructure/database/repositories/task.repository';
@Injectable()
export class TaskService {
constructor(private readonly taskRepository: TaskRepository) {}
async execute(done: number) {
const data = await this.taskRepository.findByState(done);
if (data.length) {
return data;
}
return null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment