mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-15 12:55:59 +00:00
TSK-807: Query only active Employees (#2753)
Signed-off-by: Vyacheslav Tumanov <me@slavatumanov.me>
This commit is contained in:
parent
0688a4dd23
commit
acd3cf7276
@ -104,7 +104,8 @@ async function queryContact (
|
|||||||
search: string,
|
search: string,
|
||||||
filter?: { in?: RelatedDocument[], nin?: RelatedDocument[] }
|
filter?: { in?: RelatedDocument[], nin?: RelatedDocument[] }
|
||||||
): Promise<ObjectSearchResult[]> {
|
): 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) {
|
if (filter?.in !== undefined || filter?.nin !== undefined) {
|
||||||
q._id = {}
|
q._id = {}
|
||||||
if (filter.in !== undefined) {
|
if (filter.in !== undefined) {
|
||||||
|
Loading…
Reference in New Issue
Block a user