import { QueryHandler } from '@nestjs/cqrs'; import { ICollection } from 'src/modules/database/interfaces/collection.interface'; import { UsersRepository } from '../../adapters/secondaries/users.repository'; import { FindAllUsersQuery } from '../../queries/find-all-users.query'; import { User } from '../entities/user'; @QueryHandler(FindAllUsersQuery) export class FindAllUsersUseCase { constructor(private readonly repository: UsersRepository) {} execute = async ( findAllUsersQuery: FindAllUsersQuery, ): Promise> => this.repository.findAll(findAllUsersQuery.page, findAllUsersQuery.perPage); }