Completed
Push — master ( 6a420e...d20b5e )
by Mathieu
18s queued 14s
created

GetPayStubsAction.index   A

Complexity

Conditions 1

Size

Total Lines 5
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 5
c 0
b 0
f 0
rs 10
cc 1
1
import {Controller, Inject, UseGuards, Get} from '@nestjs/common';
2
import {AuthGuard} from '@nestjs/passport';
3
import {ApiUseTags, ApiBearerAuth, ApiOperation} from '@nestjs/swagger';
4
import {IQueryBus} from 'src/Application/IQueryBus';
5
import {PayStubView} from 'src/Application/HumanResource/PayStub/View/PayStubView';
6
import {GetPayStubsQuery} from 'src/Application/HumanResource/PayStub/Query/GetPayStubsQuery';
7
8
@Controller('pay_stubs')
9
@ApiUseTags('Human Resource')
10
@ApiBearerAuth()
11
@UseGuards(AuthGuard('bearer'))
12
export class GetPayStubsAction {
13
  constructor(
14
    @Inject('IQueryBus')
15
    private readonly queryBus: IQueryBus
16
  ) {}
17
18
  @Get()
19
  @ApiOperation({title: 'Get all pay stubs'})
20
  public async index(): Promise<PayStubView[]> {
21
    return await this.queryBus.execute(new GetPayStubsQuery());
22
  }
23
}
24