14 lines
530 B
TypeScript
14 lines
530 B
TypeScript
|
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);
|
||
|
}
|
||
|
}
|