Total Complexity | 1 |
Complexity/F | 1 |
Lines of Code | 18 |
Function Count | 1 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import { Inject } from '@nestjs/common'; |
||
2 | import { QueryHandler } from '@nestjs/cqrs'; |
||
3 | import { IUserRepository } from 'src/Domain/User/Repository/IUserRepository'; |
||
4 | import { User } from 'src/Domain/User/User.entity'; |
||
5 | import { GetUserByEmailQuery } from './GetUserByEmailQuery'; |
||
6 | |||
7 | @QueryHandler(GetUserByEmailQuery) |
||
8 | export class GetUserByEmailQueryHandler { |
||
9 | constructor( |
||
10 | @Inject('IUserRepository') |
||
11 | private readonly userRepository: IUserRepository |
||
12 | ) {} |
||
13 | |||
14 | public async execute(query: GetUserByEmailQuery): Promise<User | undefined> { |
||
15 | return await this.userRepository.findOneByEmail(query.email); |
||
16 | } |
||
17 | } |
||
18 |