mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-22 21:50:34 +03: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) {
|
||||
const { [key]: st, space } = query
|
||||
const resQuery: DocumentQuery<Status> = {
|
||||
space
|
||||
const resQuery: DocumentQuery<Status> = {}
|
||||
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) {
|
||||
resQuery._id = st
|
||||
|
Loading…
Reference in New Issue
Block a user