mirror of
https://github.com/umami-software/umami.git
synced 2026-02-09 15:17:23 +01:00
Updated search queries.
This commit is contained in:
parent
80a58cbdd1
commit
e971f2533d
12 changed files with 90 additions and 147 deletions
|
|
@ -52,29 +52,11 @@ export async function getUsers(
|
|||
criteria: UserFindManyArgs,
|
||||
filters?: UserSearchFilter,
|
||||
): Promise<FilterResult<User[]>> {
|
||||
const { teamId, query } = filters;
|
||||
const mode = prisma.getQueryMode();
|
||||
const { query } = filters;
|
||||
|
||||
const where: Prisma.UserWhereInput = {
|
||||
...(teamId && {
|
||||
teamUser: {
|
||||
some: {
|
||||
teamId,
|
||||
},
|
||||
},
|
||||
}),
|
||||
...(query && {
|
||||
AND: {
|
||||
OR: [
|
||||
{
|
||||
username: {
|
||||
contains: query,
|
||||
mode,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
}),
|
||||
...criteria.where,
|
||||
...prisma.getSearchParameters(query, [{ username: 'contains' }]),
|
||||
deletedAt: null,
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue