Total Complexity | 2 |
Total Lines | 19 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | import {Controller, Get, Inject, Param, UseGuards, NotFoundException} from '@nestjs/common'; |
||
10 | |||
11 | @Controller('users') |
||
12 | @ApiTags('Human Resource') |
||
13 | @ApiBearerAuth() |
||
14 | @UseGuards(AuthGuard('bearer')) |
||
15 | export class GetUserAdministrativeAction { |
||
16 | constructor( |
||
17 | @Inject('IQueryBus') |
||
18 | private readonly queryBus: IQueryBus |
||
19 | ) {} |
||
20 | |||
21 | @Get(':id') |
||
22 | @Roles(UserRole.COOPERATOR) |
||
23 | @ApiOperation({summary: 'Get user'}) |
||
24 | public async index(@Param() dto: IdDTO): Promise<UserAdministrativeView> { |
||
25 | try { |
||
26 | return await this.queryBus.execute(new GetUserAdministrativeByIdQuery(dto.id)); |
||
27 | } catch (e) { |
||
28 | throw new NotFoundException(e.message); |
||
29 | } |
||
32 |