Skip to content

Commit

Permalink
feat: support username query in units & citizens search (closes #1896)
Browse files Browse the repository at this point in the history
  • Loading branch information
casperiv0 committed Jun 17, 2024
1 parent 2361590 commit 440f2d6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export class AdminManageCitizensController {
name: { equals: surname, mode: Prisma.QueryMode.insensitive },
surname: { equals: name, mode: Prisma.QueryMode.insensitive },
},
{ user: { username: { contains: query, mode: Prisma.QueryMode.insensitive } } },
],
}
: undefined;
Expand Down
3 changes: 2 additions & 1 deletion apps/api/src/controllers/leo/create-where-obj.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type Prisma } from "@prisma/client";
import { Prisma } from "@prisma/client";
import { WhitelistStatus } from "@snailycad/types";

interface CreateWhereObjOptions<Type extends "OFFICER" | "DEPUTY"> {
Expand Down Expand Up @@ -70,6 +70,7 @@ export function createWhere<Type extends "OFFICER" | "DEPUTY">({
],
},
},
{ user: { username: { contains: query, mode: Prisma.QueryMode.insensitive } } },
type === "OFFICER"
? {
divisions: { some: { value: { value: { contains: query, mode: "insensitive" } } } },
Expand Down

0 comments on commit 440f2d6

Please sign in to comment.