mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-13 03:40:48 +00:00
UBER-885: Value filter fix (#3719)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
parent
aa1b41157b
commit
25b048f8e8
@ -74,19 +74,29 @@
|
||||
}
|
||||
const isDerivedFromSpace = hierarchy.isDerived(_class, core.class.Space)
|
||||
|
||||
const notArchived =
|
||||
space === undefined || isDerivedFromSpace
|
||||
const spaces =
|
||||
space !== undefined || isDerivedFromSpace
|
||||
? []
|
||||
: (await client.findAll(core.class.Space, { archived: { $ne: true } }, { projection: { _id: 1 } })).map(
|
||||
(it) => it._id
|
||||
)
|
||||
: (
|
||||
await client.findAll(
|
||||
core.class.Space,
|
||||
{ archived: { $ne: true } },
|
||||
{
|
||||
projection: {
|
||||
_id: 1,
|
||||
archived: 1,
|
||||
_class: 1
|
||||
}
|
||||
}
|
||||
)
|
||||
).map((it) => it._id)
|
||||
|
||||
async function doQuery (limit: number | undefined, first1000?: any[]): Promise<boolean> {
|
||||
const p = client.findAll(
|
||||
_class,
|
||||
{
|
||||
...resultQuery,
|
||||
...(space ? { space } : isDerivedFromSpace ? { archived: false } : { space: { $in: notArchived } }),
|
||||
...(space ? { space } : isDerivedFromSpace ? { archived: false } : { space: { $in: spaces } }),
|
||||
...(first1000 ? { [filter.key.key]: { $nin: first1000 } } : {})
|
||||
},
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user