Conditions | 2 |
Total Lines | 24 |
Code Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import {Inject} from '@nestjs/common'; |
||
15 | |||
16 | public async execute(query: GetPayStubsQuery): Promise<PayStubView[]> { |
||
17 | const payStubs = await this.payStubRepository.findAll(); |
||
18 | const payStubViews: PayStubView[] = []; |
||
19 | |||
20 | for (const payStub of payStubs) { |
||
21 | const user = payStub.getUser(); |
||
22 | const file = payStub.getFile(); |
||
23 | |||
24 | payStubViews.push( |
||
25 | new PayStubView( |
||
26 | payStub.getId(), |
||
27 | payStub.getDate(), |
||
28 | new UserSummaryView( |
||
29 | user.getId(), |
||
30 | user.getFirstName(), |
||
31 | user.getLastName() |
||
32 | ), |
||
33 | new FileView(file.getId(), file.getName(), file.getSize()) |
||
34 | ) |
||
35 | ); |
||
36 | } |
||
37 | |||
38 | return payStubViews; |
||
39 | } |
||
41 |