feat: filter deed types by name (#55)
solve this ticket: https://app.ora.pm/p/fb56ed95daa7456b888d266a050b9afa?v=86662&s=29580&t=k&c=7df9ce7b32774f9fabc9fbb9fad90529
This commit is contained in:
commit
6c2de42621
@ -29,6 +29,19 @@ export default class DeedTypesController extends ApiController {
|
|||||||
if (req.query["q"]) {
|
if (req.query["q"]) {
|
||||||
query = JSON.parse(req.query["q"] as string);
|
query = JSON.parse(req.query["q"] as string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (req.query["search"] && typeof req.query["search"] === "string") {
|
||||||
|
const filter = req.query["search"];
|
||||||
|
query = {
|
||||||
|
where: {
|
||||||
|
name: {
|
||||||
|
contains: filter,
|
||||||
|
mode: "insensitive",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
const officeId: string = req.body.user.office_Id;
|
const officeId: string = req.body.user.office_Id;
|
||||||
const officeWhereInput: Prisma.OfficesWhereInput = { uid: officeId } ;
|
const officeWhereInput: Prisma.OfficesWhereInput = { uid: officeId } ;
|
||||||
if(!query.where) query.where = { office: officeWhereInput};
|
if(!query.where) query.where = { office: officeWhereInput};
|
||||||
|
@ -29,6 +29,19 @@ export default class DeedTypesController extends ApiController {
|
|||||||
if (req.query["q"]) {
|
if (req.query["q"]) {
|
||||||
query = JSON.parse(req.query["q"] as string);
|
query = JSON.parse(req.query["q"] as string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (req.query["search"] && typeof req.query["search"] === "string") {
|
||||||
|
const filter = req.query["search"];
|
||||||
|
query = {
|
||||||
|
where: {
|
||||||
|
name: {
|
||||||
|
contains: filter,
|
||||||
|
mode: "insensitive",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
const officeId: string = req.body.user.office_Id;
|
const officeId: string = req.body.user.office_Id;
|
||||||
const officeWhereInput: Prisma.OfficesWhereInput = { uid: officeId } ;
|
const officeWhereInput: Prisma.OfficesWhereInput = { uid: officeId } ;
|
||||||
if(!query.where) query.where = { office: officeWhereInput};
|
if(!query.where) query.where = { office: officeWhereInput};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user