feat: add code to query string

This commit is contained in:
Methapon2001 2024-12-25 10:41:48 +07:00
parent f2c1e84490
commit 5e26e38e0b
2 changed files with 5 additions and 0 deletions

View file

@ -190,6 +190,7 @@ export class QuotationController extends Controller {
@Query() payCondition?: PayCondition,
@Query() status?: QuotationStatus,
@Query() urgentFirst?: boolean,
@Query() code?: string,
@Query() query = "",
) {
const where = {
@ -209,6 +210,7 @@ export class QuotationController extends Controller {
},
},
]),
code,
payCondition,
registeredBranch: isSystem(req.user) ? undefined : { OR: permissionCond(req.user) },
quotationStatus: status,

View file

@ -73,9 +73,11 @@ export class RequestDataController extends Controller {
@Query() query: string = "",
@Query() requestDataStatus?: RequestDataStatus,
@Query() quotationId?: string,
@Query() code?: string,
) {
const where = {
OR: queryOrNot<Prisma.RequestDataWhereInput[]>(query, [
{ code: { contains: query, mode: "insensitive" } },
{ quotation: { code: { contains: query, mode: "insensitive" } } },
{ quotation: { workName: { contains: query } } },
{
@ -109,6 +111,7 @@ export class RequestDataController extends Controller {
},
},
]),
code,
requestDataStatus,
quotation: {
id: quotationId,