| Total Complexity | 2 |
| Total Lines | 23 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import { |
||
| 18 | |||
| 19 | @Controller('holidays') |
||
| 20 | @ApiUseTags('Human Resource') |
||
| 21 | @ApiBearerAuth() |
||
| 22 | @UseGuards(AuthGuard('bearer'), RolesGuard) |
||
| 23 | export class RefuseHolidayAction { |
||
| 24 | constructor( |
||
| 25 | @Inject('ICommandBus') |
||
| 26 | private readonly commandBus: ICommandBus |
||
| 27 | ) {} |
||
| 28 | |||
| 29 | @Put(':id/refuse') |
||
| 30 | @Roles(UserRole.COOPERATOR) |
||
| 31 | @ApiOperation({title: 'Refuse holiday'}) |
||
| 32 | public async index(@Param() dto: IdDTO, @LoggedUser() user: User) { |
||
| 33 | try { |
||
| 34 | const id = await this.commandBus.execute( |
||
| 35 | new RefuseHolidayCommand(user, dto.id) |
||
| 36 | ); |
||
| 37 | |||
| 38 | return {id}; |
||
| 39 | } catch (e) { |
||
| 40 | throw new BadRequestException(e.message); |
||
| 41 | } |
||
| 44 |