| Total Complexity | 2 | 
| Complexity/F | 2 | 
| Lines of Code | 24 | 
| Function Count | 1 | 
| Duplicated Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | import { QueryHandler } from '@nestjs/cqrs'; | 
            ||
| 2 | import { Inject } from '@nestjs/common'; | 
            ||
| 3 | import { GetCooperativeQuery } from './GetCooperativeQuery'; | 
            ||
| 4 | import { ICooperativeRepository } from 'src/Domain/Settings/Repository/ICooperativeRepository'; | 
            ||
| 5 | import { CooperativeNotFoundException } from 'src/Domain/Settings/Repository/CooperativeNotFoundException'; | 
            ||
| 6 | import { CooperativeView } from '../View/CooperativeView'; | 
            ||
| 7 | |||
| 8 | @QueryHandler(GetCooperativeQuery)  | 
            ||
| 9 | export class GetCooperativeQueryHandler { | 
            ||
| 10 | constructor(  | 
            ||
| 11 |     @Inject('ICooperativeRepository') | 
            ||
| 12 | private readonly cooperativeRepository: ICooperativeRepository  | 
            ||
| 13 |   ) {} | 
            ||
| 14 | |||
| 15 |   public async execute(query: GetCooperativeQuery): Promise<CooperativeView> { | 
            ||
| 16 | const cooperative = await this.cooperativeRepository.find();  | 
            ||
| 17 |     if (!cooperative) { | 
            ||
| 18 | throw new CooperativeNotFoundException();  | 
            ||
| 19 | }  | 
            ||
| 20 | |||
| 21 | return new CooperativeView(cooperative.getDayDuration());  | 
            ||
| 22 | }  | 
            ||
| 23 | }  | 
            ||
| 24 |