| Conditions | 2 | 
| Total Lines | 36 | 
| Code Lines | 24 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | import {Inject} from '@nestjs/common'; | 
            ||
| 16 | |||
| 17 |   public async execute(command: CreateHolidayCommand): Promise<string> { | 
            ||
| 18 |     const { | 
            ||
| 19 | user,  | 
            ||
| 20 | endDate,  | 
            ||
| 21 | endsAllDay,  | 
            ||
| 22 | leaveType,  | 
            ||
| 23 | startDate,  | 
            ||
| 24 | startsAllDay,  | 
            ||
| 25 | comment  | 
            ||
| 26 | } = command;  | 
            ||
| 27 | |||
| 28 | if (  | 
            ||
| 29 | true ===  | 
            ||
| 30 | (await this.doesHolidayExistForPeriod.isSatisfiedBy(  | 
            ||
| 31 | user,  | 
            ||
| 32 | startDate,  | 
            ||
| 33 | endDate  | 
            ||
| 34 | ))  | 
            ||
| 35 |     ) { | 
            ||
| 36 | throw new HolidayAlreadyExistForThisPeriodException();  | 
            ||
| 37 | }  | 
            ||
| 38 | |||
| 39 | const holiday = await this.holidayRepository.save(  | 
            ||
| 40 | new Holiday(  | 
            ||
| 41 | user,  | 
            ||
| 42 | leaveType,  | 
            ||
| 43 | startDate,  | 
            ||
| 44 | startsAllDay,  | 
            ||
| 45 | endDate,  | 
            ||
| 46 | endsAllDay,  | 
            ||
| 47 | comment  | 
            ||
| 48 | )  | 
            ||
| 49 | );  | 
            ||
| 50 | |||
| 51 | return holiday.getId();  | 
            ||
| 52 | }  | 
            ||
| 54 |