| Conditions | 2 |
| Total Lines | 28 |
| Code Lines | 24 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import { |
||
| 28 | |||
| 29 | @Put(':id') |
||
| 30 | @Roles(UserRole.COOPERATOR, UserRole.EMPLOYEE) |
||
| 31 | @ApiOperation({ summary: 'Update existing leave request' }) |
||
| 32 | public async index( |
||
| 33 | @Param() { id }, |
||
| 34 | @Body() dto: LeaveRequestDTO, |
||
| 35 | ) { |
||
| 36 | const { type, startDate, startsAllDay, endDate, endsAllDay, comment } = dto; |
||
| 37 | |||
| 38 | |||
| 39 | |||
| 40 | try { |
||
| 41 | await this.commandBus.execute( |
||
| 42 | new UpdateLeaveRequestCommand( |
||
| 43 | id, |
||
| 44 | type, |
||
| 45 | startDate, |
||
| 46 | startsAllDay, |
||
| 47 | endDate, |
||
| 48 | endsAllDay, |
||
| 49 | comment |
||
| 50 | ) |
||
| 51 | ); |
||
| 52 | |||
| 53 | return { id }; |
||
| 54 | } catch (e) { |
||
| 55 | throw new BadRequestException(e.message); |
||
| 56 | } |
||
| 59 |