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,
|
createPermCheck,
|
||||||
createPermCondition,
|
createPermCondition,
|
||||||
} from "../services/permission";
|
} from "../services/permission";
|
||||||
|
import { PaymentStatus } from "../generated/kysely/types";
|
||||||
|
|
||||||
type InvoicePayload = {
|
type InvoicePayload = {
|
||||||
quotationId: string;
|
quotationId: string;
|
||||||
|
|
@ -54,8 +55,18 @@ export class InvoiceController extends Controller {
|
||||||
};
|
};
|
||||||
|
|
||||||
const [pay, notPay] = await prisma.$transaction([
|
const [pay, notPay] = await prisma.$transaction([
|
||||||
prisma.invoice.count({ where: { ...where, payment: { isNot: null } } }),
|
prisma.invoice.count({
|
||||||
prisma.invoice.count({ where: { ...where, payment: null } }),
|
where: {
|
||||||
|
...where,
|
||||||
|
payment: { paymentStatus: { not: PaymentStatus.PaymentSuccess } },
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
prisma.invoice.count({
|
||||||
|
where: {
|
||||||
|
...where,
|
||||||
|
payment: { paymentStatus: PaymentStatus.PaymentSuccess },
|
||||||
|
},
|
||||||
|
}),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return { pay, notPay };
|
return { pay, notPay };
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue