fix: make it check for status
This commit is contained in:
parent
abf20e0fb1
commit
c399cd26df
1 changed files with 13 additions and 2 deletions
|
|
@ -20,6 +20,7 @@ import {
|
|||
createPermCheck,
|
||||
createPermCondition,
|
||||
} from "../services/permission";
|
||||
import { PaymentStatus } from "../generated/kysely/types";
|
||||
|
||||
type InvoicePayload = {
|
||||
quotationId: string;
|
||||
|
|
@ -54,8 +55,18 @@ export class InvoiceController extends Controller {
|
|||
};
|
||||
|
||||
const [pay, notPay] = await prisma.$transaction([
|
||||
prisma.invoice.count({ where: { ...where, payment: { isNot: null } } }),
|
||||
prisma.invoice.count({ where: { ...where, payment: null } }),
|
||||
prisma.invoice.count({
|
||||
where: {
|
||||
...where,
|
||||
payment: { paymentStatus: { not: PaymentStatus.PaymentSuccess } },
|
||||
},
|
||||
}),
|
||||
prisma.invoice.count({
|
||||
where: {
|
||||
...where,
|
||||
payment: { paymentStatus: PaymentStatus.PaymentSuccess },
|
||||
},
|
||||
}),
|
||||
]);
|
||||
|
||||
return { pay, notPay };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue