add insensitive search
This commit is contained in:
parent
743fde5493
commit
afe54b1a4e
1 changed files with 7 additions and 3 deletions
|
|
@ -2,6 +2,7 @@ import { Body, Controller, Get, Path, Post, Query, Route, Tags } from "tsoa";
|
||||||
import prisma from "../db";
|
import prisma from "../db";
|
||||||
import { queryOrNot } from "../utils/relation";
|
import { queryOrNot } from "../utils/relation";
|
||||||
import { notFoundError } from "../utils/error";
|
import { notFoundError } from "../utils/error";
|
||||||
|
import { Prisma } from "@prisma/client";
|
||||||
|
|
||||||
@Route("/api/v1/employment-office")
|
@Route("/api/v1/employment-office")
|
||||||
@Tags("Employment Office")
|
@Tags("Employment Office")
|
||||||
|
|
@ -40,11 +41,14 @@ export class EmploymentOfficeController extends Controller {
|
||||||
],
|
],
|
||||||
[],
|
[],
|
||||||
),
|
),
|
||||||
...queryOrNot(
|
...(queryOrNot(
|
||||||
query,
|
query,
|
||||||
[{ name: { contains: query } }, { nameEN: { contains: query } }],
|
[
|
||||||
|
{ name: { contains: query, mode: "insensitive" } },
|
||||||
|
{ nameEN: { contains: query, mode: "insensitive" } },
|
||||||
|
],
|
||||||
[],
|
[],
|
||||||
),
|
) satisfies Prisma.EmploymentOfficeWhereInput["OR"]),
|
||||||
...queryOrNot(!!body?.id, [{ id: { in: body?.id } }], []),
|
...queryOrNot(!!body?.id, [{ id: { in: body?.id } }], []),
|
||||||
]
|
]
|
||||||
: undefined,
|
: undefined,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue