TSK-807: Query only active Employees (#2753)

Signed-off-by: Vyacheslav Tumanov <me@slavatumanov.me>
This commit is contained in:
Vyacheslav Tumanov 2023-03-16 16:36:49 +05:00 committed by GitHub
parent 0688a4dd23
commit acd3cf7276
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -104,7 +104,8 @@ async function queryContact (
search: string,
filter?: { in?: RelatedDocument[], nin?: RelatedDocument[] }
): Promise<ObjectSearchResult[]> {
const q: DocumentQuery<Contact> = { name: { $like: `%${search}%` } }
let q: DocumentQuery<Contact> = { name: { $like: `%${search}%` } }
if (_class === contact.class.Employee) q = { ...q, active: true }
if (filter?.in !== undefined || filter?.nin !== undefined) {
q._id = {}
if (filter.in !== undefined) {