mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-23 16:56:07 +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 isDerivedFromSpace = hierarchy.isDerived(_class, core.class.Space)
|
||||||
|
|
||||||
const notArchived =
|
const spaces =
|
||||||
space === undefined || isDerivedFromSpace
|
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> {
|
async function doQuery (limit: number | undefined, first1000?: any[]): Promise<boolean> {
|
||||||
const p = client.findAll(
|
const p = client.findAll(
|
||||||
_class,
|
_class,
|
||||||
{
|
{
|
||||||
...resultQuery,
|
...resultQuery,
|
||||||
...(space ? { space } : isDerivedFromSpace ? { archived: false } : { space: { $in: notArchived } }),
|
...(space ? { space } : isDerivedFromSpace ? { archived: false } : { space: { $in: spaces } }),
|
||||||
...(first1000 ? { [filter.key.key]: { $nin: first1000 } } : {})
|
...(first1000 ? { [filter.key.key]: { $nin: first1000 } } : {})
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user