fix: Add validation for date filtering in payment status endpoint
Deploy Application / deploy (push) Successful in 33s
Details
Deploy Application / deploy (push) Successful in 33s
Details
This commit is contained in:
parent
b75a62dc70
commit
b3e2a16c8e
|
|
@ -445,6 +445,13 @@ export async function paymentStatus(req: Request, res: Response) {
|
||||||
|
|
||||||
const where: any = {};
|
const where: any = {};
|
||||||
if (startdate || enddate) {
|
if (startdate || enddate) {
|
||||||
|
if (!startdate || !enddate) {
|
||||||
|
return res
|
||||||
|
.status(400)
|
||||||
|
.json({
|
||||||
|
error: "startdate and enddate are required when filtering by date",
|
||||||
|
});
|
||||||
|
}
|
||||||
where.created_at = {} as any;
|
where.created_at = {} as any;
|
||||||
if (startdate) {
|
if (startdate) {
|
||||||
const s = new Date(String(startdate));
|
const s = new Date(String(startdate));
|
||||||
|
|
@ -462,14 +469,6 @@ export async function paymentStatus(req: Request, res: Response) {
|
||||||
if (c_invoice_id) {
|
if (c_invoice_id) {
|
||||||
where.c_invoice_id = Number(c_invoice_id);
|
where.c_invoice_id = Number(c_invoice_id);
|
||||||
}
|
}
|
||||||
console.log({
|
|
||||||
...where,
|
|
||||||
and: {
|
|
||||||
NOT: {
|
|
||||||
c_invoice_id: null,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const rows = await db.transactions_lines.findMany({
|
const rows = await db.transactions_lines.findMany({
|
||||||
where: {
|
where: {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue