feat: add get institution list by criteria
This commit is contained in:
parent
d48e6b4a28
commit
178a4d005b
1 changed files with 17 additions and 1 deletions
|
|
@ -56,9 +56,25 @@ export class InstitutionController extends Controller {
|
||||||
@Query() page: number = 1,
|
@Query() page: number = 1,
|
||||||
@Query() pageSize: number = 30,
|
@Query() pageSize: number = 30,
|
||||||
@Query() group?: string,
|
@Query() group?: string,
|
||||||
|
) {
|
||||||
|
return this.getInstitutionListByCriteria(query, page, pageSize, group);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Post("list")
|
||||||
|
@Security("keycloak")
|
||||||
|
@OperationId("getInstitutionListByCriteria")
|
||||||
|
async getInstitutionListByCriteria(
|
||||||
|
@Query() query: string = "",
|
||||||
|
@Query() page: number = 1,
|
||||||
|
@Query() pageSize: number = 30,
|
||||||
|
@Query() group?: string,
|
||||||
|
@Body()
|
||||||
|
body?: {
|
||||||
|
group?: string[];
|
||||||
|
},
|
||||||
) {
|
) {
|
||||||
const where = {
|
const where = {
|
||||||
group,
|
group: body?.group ? { in: body.group } : group,
|
||||||
OR: queryOrNot<Prisma.InstitutionWhereInput[]>(query, [
|
OR: queryOrNot<Prisma.InstitutionWhereInput[]>(query, [
|
||||||
{ name: { contains: query } },
|
{ name: { contains: query } },
|
||||||
{ code: { contains: query, mode: "insensitive" } },
|
{ code: { contains: query, mode: "insensitive" } },
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue