Add search Mode for mysql.

This commit is contained in:
Brian Cao 2023-08-15 10:57:25 -07:00
parent 8f542ed998
commit 203f4e8e03
5 changed files with 32 additions and 11 deletions

View file

@ -41,6 +41,8 @@ export async function getUsers(
options?: { include?: Prisma.UserInclude },
): Promise<FilterResult<User[]>> {
const { teamId, filter, filterType = USER_FILTER_TYPES.all } = UserSearchFilter;
const mode = prisma.getSearchMode();
const where: Prisma.UserWhereInput = {
...(teamId && {
teamUser: {
@ -57,7 +59,7 @@ export async function getUsers(
filterType === USER_FILTER_TYPES.username) && {
username: {
startsWith: filter,
mode: 'insensitive',
...mode,
},
}),
},