feat: filter office by name (#54)
solve this ticket : https://app.ora.pm/p/fb56ed95daa7456b888d266a050b9afa?v=86662&s=29580&t=k&c=c3617927e1104177a7ee19d389ddcbb7
This commit is contained in:
commit
bfbbde7f4d
@ -26,6 +26,19 @@ export default class OfficesController extends ApiController {
|
||||
if (req.query["q"]) {
|
||||
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",
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//call service to get prisma entity
|
||||
const officesEntities: Offices[] = await this.officesService.get(query);
|
||||
//Hydrate ressource with prisma entity
|
||||
|
Loading…
x
Reference in New Issue
Block a user