Total Complexity | 2 |
Complexity/F | 2 |
Lines of Code | 27 |
Function Count | 1 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import {Inject} from '@nestjs/common'; |
||
2 | import { |
||
3 | Holiday, |
||
4 | HolidayLeaveType |
||
5 | } from '../../HumanResource/Holiday/Holiday.entity'; |
||
6 | import {Event, EventType} from 'src/Domain/FairCalendar/Event.entity'; |
||
7 | import {IEventRepository} from '../Repository/IEventRepository'; |
||
8 | |||
9 | export class HolidayToEventsConverter { |
||
10 | constructor( |
||
11 | @Inject('IEventRepository') |
||
12 | private readonly eventRepository: IEventRepository |
||
13 | ) {} |
||
14 | |||
15 | public async convert(holiday: Holiday): Promise<void> { |
||
16 | const events: Event[] = []; |
||
17 | const type = |
||
18 | holiday.getLeaveType() === HolidayLeaveType.MEDICAL |
||
19 | ? EventType.MEDICAL_LEAVE |
||
20 | : EventType.HOLIDAY; |
||
21 | |||
22 | events.push(new Event(type, holiday.getUser(), 100, '2020-01-01')); |
||
23 | |||
24 | //return events; |
||
25 | } |
||
26 | } |
||
27 |