|
@ -312,10 +312,14 @@ export class OrderService { |
|
|
ACCOUNT: filtersByAccount, |
|
|
ACCOUNT: filtersByAccount, |
|
|
ASSET_CLASS: filtersByAssetClass, |
|
|
ASSET_CLASS: filtersByAssetClass, |
|
|
TAG: filtersByTag |
|
|
TAG: filtersByTag |
|
|
} = groupBy(filters, (filter) => { |
|
|
} = groupBy(filters, ({ type }) => { |
|
|
return filter.type; |
|
|
return type; |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
const searchQuery = filters?.find(({ type }) => { |
|
|
|
|
|
return type === 'SEARCH_QUERY'; |
|
|
|
|
|
})?.id; |
|
|
|
|
|
|
|
|
if (filtersByAccount?.length > 0) { |
|
|
if (filtersByAccount?.length > 0) { |
|
|
where.accountId = { |
|
|
where.accountId = { |
|
|
in: filtersByAccount.map(({ id }) => { |
|
|
in: filtersByAccount.map(({ id }) => { |
|
@ -357,6 +361,30 @@ export class OrderService { |
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (searchQuery) { |
|
|
|
|
|
const searchQueryWhereInput: Prisma.SymbolProfileWhereInput[] = [ |
|
|
|
|
|
{ id: { mode: 'insensitive', startsWith: searchQuery } }, |
|
|
|
|
|
{ isin: { mode: 'insensitive', startsWith: searchQuery } }, |
|
|
|
|
|
{ name: { mode: 'insensitive', startsWith: searchQuery } }, |
|
|
|
|
|
{ symbol: { mode: 'insensitive', startsWith: searchQuery } } |
|
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
if (where.SymbolProfile) { |
|
|
|
|
|
where.SymbolProfile = { |
|
|
|
|
|
AND: [ |
|
|
|
|
|
where.SymbolProfile, |
|
|
|
|
|
{ |
|
|
|
|
|
OR: searchQueryWhereInput |
|
|
|
|
|
} |
|
|
|
|
|
] |
|
|
|
|
|
}; |
|
|
|
|
|
} else { |
|
|
|
|
|
where.SymbolProfile = { |
|
|
|
|
|
OR: searchQueryWhereInput |
|
|
|
|
|
}; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if (filtersByTag?.length > 0) { |
|
|
if (filtersByTag?.length > 0) { |
|
|
where.tags = { |
|
|
where.tags = { |
|
|
some: { |
|
|
some: { |
|
|