fix: search and pendingOnly get mixed
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 3s

This commit is contained in:
Methapon2001 2025-07-21 13:25:34 +07:00
parent 92762c512d
commit ccadd5ea55

View file

@ -613,10 +613,7 @@ export class LineController extends Controller {
@Query() endDate?: Date,
) {
const where = {
OR:
query || pendingOnly
? [
...(queryOrNot<Prisma.QuotationWhereInput[]>(query, [
OR: queryOrNot<Prisma.QuotationWhereInput[]>(query, [
{ code: { contains: query, mode: "insensitive" } },
{ workName: { contains: query, mode: "insensitive" } },
{
@ -631,21 +628,7 @@ export class LineController extends Controller {
],
},
},
]) || []),
...(queryOrNot<Prisma.QuotationWhereInput[]>(!!pendingOnly, [
{
requestData: {
some: {
requestDataStatus: "Pending",
},
},
},
{
requestData: { none: {} },
},
]) || []),
]
: undefined,
]),
isDebitNote: false,
code,
payCondition,
@ -667,6 +650,20 @@ export class LineController extends Controller {
},
}
: undefined,
AND: pendingOnly
? [
{
requestData: {
some: {
requestDataStatus: "Pending",
},
},
},
{
requestData: { none: {} },
},
]
: undefined,
...whereDateQuery(startDate, endDate),
} satisfies Prisma.QuotationWhereInput;