mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-23 00:37:47 +00:00
Fix status space query (#2973)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
f0928324c5
commit
ee085dcc5b
@ -136,8 +136,17 @@ export async function showEmptyGroups (
|
|||||||
})
|
})
|
||||||
if (query !== undefined) {
|
if (query !== undefined) {
|
||||||
const { [key]: st, space } = query
|
const { [key]: st, space } = query
|
||||||
const resQuery: DocumentQuery<Status> = {
|
const resQuery: DocumentQuery<Status> = {}
|
||||||
space
|
if (space !== undefined) {
|
||||||
|
resQuery.space = space
|
||||||
|
} else {
|
||||||
|
const spaceRefs = Array.from(new Set(statusList.map((p) => p.space)))
|
||||||
|
const spaces = await client.findAll(
|
||||||
|
core.class.Space,
|
||||||
|
{ _id: { $in: spaceRefs }, archived: false },
|
||||||
|
{ projection: { _id: 1 } }
|
||||||
|
)
|
||||||
|
resQuery.space = { $in: spaces.map((p) => p._id) }
|
||||||
}
|
}
|
||||||
if (st !== undefined) {
|
if (st !== undefined) {
|
||||||
resQuery._id = st
|
resQuery._id = st
|
||||||
|
Loading…
Reference in New Issue
Block a user