Arnaud D. Natali 2023-07-13 16:01:34 +02:00 committed by GitHub
commit 49d17ad14b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 2 deletions

View File

@ -27,6 +27,21 @@ export default class UsersController 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: {
contact: {
OR: [
{ first_name: { contains: filter, mode: "insensitive" } },
{ last_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_membership: officeWhereInput }; if (!query.where) query.where = { office_membership: officeWhereInput };

View File

@ -27,6 +27,20 @@ export default class UsersController extends ApiController {
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: {
contact: {
OR: [
{ first_name: { contains: filter, mode: "insensitive" } },
{ last_name: { contains: filter, mode: "insensitive" } },
],
},
},
};
}
//call service to get prisma entity //call service to get prisma entity
const usersEntities = await this.usersService.get(query); const usersEntities = await this.usersService.get(query);