UBER-694 Fix accounts query filter (#3562)

Signed-off-by: Alexander Onnikov <alexander.onnikov@xored.com>
This commit is contained in:
Alexander Onnikov 2023-08-07 16:15:11 +07:00 committed by GitHub
parent cd52b8e684
commit eaaef54fa6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -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 } })
}

View File

@ -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) }
})