Conditions | 1 |
Total Lines | 22 |
Code Lines | 21 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import {InjectRepository} from '@nestjs/typeorm'; |
||
24 | |||
25 | public findQuotes(page: number): Promise<[Quote[], number]> { |
||
26 | return this.repository |
||
27 | .createQueryBuilder('quote') |
||
28 | .select([ |
||
29 | 'quote.id', |
||
30 | 'quote.quoteId', |
||
31 | 'quote.status', |
||
32 | 'quote.createdAt', |
||
33 | 'project.id', |
||
34 | 'project.name', |
||
35 | 'customer.id', |
||
36 | 'customer.name', |
||
37 | 'item.quantity', |
||
38 | 'item.dailyRate' |
||
39 | ]) |
||
40 | .innerJoin('quote.customer', 'customer') |
||
41 | .innerJoin('quote.items', 'item') |
||
42 | .leftJoin('quote.project', 'project') |
||
43 | .orderBy('quote.createdAt', 'DESC') |
||
44 | .limit(MAX_ITEMS_PER_PAGE) |
||
45 | .offset((page - 1) * MAX_ITEMS_PER_PAGE) |
||
46 | .getManyAndCount(); |
||
57 |