Total Complexity | 1 |
Complexity/F | 1 |
Lines of Code | 24 |
Function Count | 1 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import { Controller, Inject, Get, UseGuards } from '@nestjs/common'; |
||
2 | import { AuthGuard } from '@nestjs/passport'; |
||
3 | import { ApiTags, ApiOperation, ApiBearerAuth } from '@nestjs/swagger'; |
||
4 | import { GetUsersPresenceQuery } from 'src/Application/HumanResource/User/Query/GetUsersPresenceQuery'; |
||
5 | import { UserPresenceView } from 'src/Application/HumanResource/User/View/UserPresenceView'; |
||
6 | import { IQueryBus } from 'src/Application/IQueryBus'; |
||
7 | |||
8 | @Controller('users') |
||
9 | @ApiTags('Human Resource') |
||
10 | @ApiBearerAuth() |
||
11 | @UseGuards(AuthGuard('bearer')) |
||
12 | export class GetUsersPresenceAction { |
||
13 | constructor( |
||
14 | @Inject('IQueryBus') |
||
15 | private readonly queryBus: IQueryBus |
||
16 | ) {} |
||
17 | |||
18 | @Get('presence') |
||
19 | @ApiOperation({summary: 'Who\'s there or not today?'}) |
||
20 | public async index(): Promise<UserPresenceView[]> { |
||
21 | return await this.queryBus.execute(new GetUsersPresenceQuery()); |
||
22 | } |
||
23 | } |
||
24 |