fix: total count bigint cannot be serialize
This commit is contained in:
parent
acec110c51
commit
c79851d074
1 changed files with 4 additions and 4 deletions
|
|
@ -66,15 +66,15 @@ export class ProductServiceController extends Controller {
|
|||
${and.length > 0 ? Prisma.join(and, " AND ", "(", ")") : Prisma.empty}
|
||||
`;
|
||||
|
||||
const [result, { total }] = await prisma.$transaction([
|
||||
const [result, [{ total }]] = await prisma.$transaction([
|
||||
prisma.$queryRaw<((Product & { type: "product" }) | (Service & { type: "service" }))[]>`
|
||||
SELECT * FROM (${union}) AS "ProductService"
|
||||
${where}
|
||||
ORDER BY "ProductService"."statusOrder" ASC, "ProductService"."createdAt" ASC
|
||||
LIMIT ${pageSize} OFFSET ${(page - 1) * pageSize}
|
||||
`,
|
||||
prisma.$queryRaw<{ total: number }>`
|
||||
SELECT COUNT( * ) AS "total" FROM (${union}) as "ProductService"
|
||||
prisma.$queryRaw<[{ total: number }]>`
|
||||
SELECT COUNT(*) AS "total" FROM (${union}) as "ProductService"
|
||||
${where}
|
||||
`,
|
||||
]);
|
||||
|
|
@ -82,7 +82,7 @@ export class ProductServiceController extends Controller {
|
|||
result,
|
||||
page,
|
||||
pageSize,
|
||||
total,
|
||||
total: +String(total),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue