|
@ -345,13 +345,19 @@ export class OrderService { |
|
|
const { |
|
|
const { |
|
|
ACCOUNT: filtersByAccount, |
|
|
ACCOUNT: filtersByAccount, |
|
|
ASSET_CLASS: filtersByAssetClass, |
|
|
ASSET_CLASS: filtersByAssetClass, |
|
|
DATA_SOURCE: filtersByDataSource, |
|
|
|
|
|
SYMBOL: filtersBySymbol, |
|
|
|
|
|
TAG: filtersByTag |
|
|
TAG: filtersByTag |
|
|
} = groupBy(filters, ({ type }) => { |
|
|
} = groupBy(filters, ({ type }) => { |
|
|
return type; |
|
|
return type; |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
const filterByDataSource = filters?.find(({ type }) => { |
|
|
|
|
|
return type === 'DATA_SOURCE'; |
|
|
|
|
|
})?.id; |
|
|
|
|
|
|
|
|
|
|
|
const filterBySymbol = filters?.find(({ type }) => { |
|
|
|
|
|
return type === 'SYMBOL'; |
|
|
|
|
|
})?.id; |
|
|
|
|
|
|
|
|
const searchQuery = filters?.find(({ type }) => { |
|
|
const searchQuery = filters?.find(({ type }) => { |
|
|
return type === 'SEARCH_QUERY'; |
|
|
return type === 'SEARCH_QUERY'; |
|
|
})?.id; |
|
|
})?.id; |
|
@ -397,25 +403,28 @@ export class OrderService { |
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (filtersByDataSource?.length > 0) { |
|
|
if (filterByDataSource && filterBySymbol) { |
|
|
|
|
|
if (where.SymbolProfile) { |
|
|
where.SymbolProfile = { |
|
|
where.SymbolProfile = { |
|
|
dataSource: { |
|
|
AND: [ |
|
|
in: <DataSource[]>filtersByDataSource.map(({ id }) => { |
|
|
where.SymbolProfile, |
|
|
return id; |
|
|
{ |
|
|
}) |
|
|
AND: [ |
|
|
|
|
|
{ dataSource: <DataSource>filterByDataSource }, |
|
|
|
|
|
{ symbol: filterBySymbol } |
|
|
|
|
|
] |
|
|
} |
|
|
} |
|
|
|
|
|
] |
|
|
}; |
|
|
}; |
|
|
} |
|
|
} else { |
|
|
|
|
|
|
|
|
if (filtersBySymbol?.length > 0) { |
|
|
|
|
|
where.SymbolProfile = { |
|
|
where.SymbolProfile = { |
|
|
symbol: { |
|
|
AND: [ |
|
|
in: filtersBySymbol.map(({ id }) => { |
|
|
{ dataSource: <DataSource>filterByDataSource }, |
|
|
return id; |
|
|
{ symbol: filterBySymbol } |
|
|
}) |
|
|
] |
|
|
} |
|
|
|
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if (searchQuery) { |
|
|
if (searchQuery) { |
|
|
const searchQueryWhereInput: Prisma.SymbolProfileWhereInput[] = [ |
|
|
const searchQueryWhereInput: Prisma.SymbolProfileWhereInput[] = [ |
|
|