feat: add quotation list endpoint (no query)

This commit is contained in:
Methapon2001 2024-07-19 10:46:28 +07:00
parent fe50a31e08
commit a2dbaf29fb

View file

@ -169,7 +169,31 @@ export class QuotationController extends Controller {
@Get()
@Security("keycloak")
async getQuotationList(@Query() page: number = 1, @Query() pageSize: number = 30) {}
async getQuotationList(@Query() page: number = 1, @Query() pageSize: number = 30) {
const [result, total] = await prisma.$transaction([
prisma.quotation.findMany({
include: {
worker: true,
service: {
include: {
_count: { select: { work: true } },
work: {
include: {
_count: { select: { productOnWork: true } },
productOnWork: {
include: { product: true },
},
},
},
},
},
},
}),
prisma.quotation.count(),
]);
return { result: result, page, pageSize, total };
}
@Post()
@Security("keycloak")