user/src/modules/users/domain/usecases/find-user-by-uuid.usecase.ts

14 lines
530 B
TypeScript
Raw Normal View History

2022-12-13 17:00:07 +00:00
import { QueryHandler } from '@nestjs/cqrs';
import { UsersRepository } from '../../adapters/secondaries/users.repository';
import { FindUserByUuidQuery } from '../../queries/find-user-by-uuid.query';
import { User } from '../entities/user';
@QueryHandler(FindUserByUuidQuery)
export class FindUserByUuidUseCase {
constructor(private readonly _usersRepository: UsersRepository) {}
async execute(findUserByUuid: FindUserByUuidQuery): Promise<User> {
return this._usersRepository.findOneByUuid(findUserByUuid.uuid);
}
}