fix: search and pendingOnly get mixed
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 3s
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 3s
This commit is contained in:
parent
92762c512d
commit
ccadd5ea55
1 changed files with 30 additions and 33 deletions
|
|
@ -613,39 +613,22 @@ export class LineController extends Controller {
|
||||||
@Query() endDate?: Date,
|
@Query() endDate?: Date,
|
||||||
) {
|
) {
|
||||||
const where = {
|
const where = {
|
||||||
OR:
|
OR: queryOrNot<Prisma.QuotationWhereInput[]>(query, [
|
||||||
query || pendingOnly
|
{ code: { contains: query, mode: "insensitive" } },
|
||||||
? [
|
{ workName: { contains: query, mode: "insensitive" } },
|
||||||
...(queryOrNot<Prisma.QuotationWhereInput[]>(query, [
|
{
|
||||||
{ code: { contains: query, mode: "insensitive" } },
|
customerBranch: {
|
||||||
{ workName: { contains: query, mode: "insensitive" } },
|
OR: [
|
||||||
{
|
{ code: { contains: query, mode: "insensitive" } },
|
||||||
customerBranch: {
|
{ registerName: { contains: query, mode: "insensitive" } },
|
||||||
OR: [
|
{ firstName: { contains: query, mode: "insensitive" } },
|
||||||
{ code: { contains: query, mode: "insensitive" } },
|
{ firstNameEN: { contains: query, mode: "insensitive" } },
|
||||||
{ registerName: { contains: query, mode: "insensitive" } },
|
{ lastName: { contains: query, mode: "insensitive" } },
|
||||||
{ firstName: { contains: query, mode: "insensitive" } },
|
{ lastNameEN: { contains: query, mode: "insensitive" } },
|
||||||
{ firstNameEN: { contains: query, mode: "insensitive" } },
|
],
|
||||||
{ lastName: { contains: query, mode: "insensitive" } },
|
},
|
||||||
{ lastNameEN: { contains: query, mode: "insensitive" } },
|
},
|
||||||
],
|
]),
|
||||||
},
|
|
||||||
},
|
|
||||||
]) || []),
|
|
||||||
...(queryOrNot<Prisma.QuotationWhereInput[]>(!!pendingOnly, [
|
|
||||||
{
|
|
||||||
requestData: {
|
|
||||||
some: {
|
|
||||||
requestDataStatus: "Pending",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
requestData: { none: {} },
|
|
||||||
},
|
|
||||||
]) || []),
|
|
||||||
]
|
|
||||||
: undefined,
|
|
||||||
isDebitNote: false,
|
isDebitNote: false,
|
||||||
code,
|
code,
|
||||||
payCondition,
|
payCondition,
|
||||||
|
|
@ -667,6 +650,20 @@ export class LineController extends Controller {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
: undefined,
|
: undefined,
|
||||||
|
AND: pendingOnly
|
||||||
|
? [
|
||||||
|
{
|
||||||
|
requestData: {
|
||||||
|
some: {
|
||||||
|
requestDataStatus: "Pending",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
requestData: { none: {} },
|
||||||
|
},
|
||||||
|
]
|
||||||
|
: undefined,
|
||||||
...whereDateQuery(startDate, endDate),
|
...whereDateQuery(startDate, endDate),
|
||||||
} satisfies Prisma.QuotationWhereInput;
|
} satisfies Prisma.QuotationWhereInput;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue