mirror of
https://github.com/hcengineering/platform.git
synced 2025-01-23 20:13:20 +00:00
UBER-694 Fix accounts query filter (#3562)
Signed-off-by: Alexander Onnikov <alexander.onnikov@xored.com>
This commit is contained in:
parent
cd52b8e684
commit
eaaef54fa6
@ -49,8 +49,8 @@
|
||||
)
|
||||
}
|
||||
|
||||
async function add (employee: Ref<Person>): Promise<void> {
|
||||
const account = await client.findOne(contact.class.PersonAccount, { employee })
|
||||
async function add (person: Ref<Person>): Promise<void> {
|
||||
const account = await client.findOne(contact.class.PersonAccount, { person })
|
||||
if (account === undefined) return
|
||||
await client.update(space, {
|
||||
$push: {
|
||||
@ -59,8 +59,8 @@
|
||||
})
|
||||
}
|
||||
|
||||
async function removeMember (employee: Ref<Person>): Promise<void> {
|
||||
const account = await client.findOne(contact.class.PersonAccount, { employee })
|
||||
async function removeMember (person: Ref<Person>): Promise<void> {
|
||||
const account = await client.findOne(contact.class.PersonAccount, { person })
|
||||
if (account === undefined) return
|
||||
await client.update(space, { $pull: { members: account._id } })
|
||||
}
|
||||
|
@ -265,7 +265,7 @@
|
||||
const map = new Map<Ref<Staff>, Department[]>()
|
||||
if (departmentStaff && departmentStaff.length > 0) {
|
||||
const ids = departmentStaff.map((staff) => staff._id)
|
||||
const staffs = await client.findAll(contact.class.PersonAccount, { employee: { $in: ids } })
|
||||
const staffs = await client.findAll(contact.class.PersonAccount, { person: { $in: ids } })
|
||||
const departments = await client.findAll(hr.class.Department, {
|
||||
members: { $in: staffs.map((staff) => staff._id) }
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user