Merge pull request #2564 from Maxime-J/prisma-fix

Fix Prisma text search with MySQL.
This commit is contained in:
Mike Cao 2024-03-05 16:01:15 -08:00 committed by GitHub
commit 180aefe885
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -200,14 +200,14 @@ async function pagedQuery<T>(model: string, criteria: T, filters: SearchFilter)
return { data, count, page: +page, pageSize: size, orderBy };
}
function getQueryMode(): Prisma.QueryMode {
function getQueryMode(): { mode?: Prisma.QueryMode } {
const db = getDatabaseType();
if (db === POSTGRESQL) {
return 'insensitive';
return { mode: 'insensitive' };
}
return 'default';
return {};
}
function getSearchParameters(query: string, filters: { [key: string]: any }[]) {
@ -222,7 +222,7 @@ function getSearchParameters(query: string, filters: { [key: string]: any }[]) {
typeof value === 'string'
? {
[value]: query,
mode,
...mode,
}
: parseFilter(value),
};