mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-13 03:40:48 +00:00
Fix filters (#2804)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
48be42610e
commit
ad6eb3a84b
@ -130,6 +130,13 @@ export class LiveQuery extends TxProcessor implements Client {
|
||||
if (this.client.getHierarchy().getDomain(_class) === DOMAIN_MODEL) {
|
||||
return await this.client.findAll(_class, query, options)
|
||||
}
|
||||
if (options?.projection !== undefined) {
|
||||
options.projection = {
|
||||
...options.projection,
|
||||
_class: 1,
|
||||
modifiedOn: 1
|
||||
}
|
||||
}
|
||||
const q = this.findQuery(_class, query, options) ?? this.createDumpQuery(_class, query, options)
|
||||
if (q.result instanceof Promise) {
|
||||
q.result = await q.result
|
||||
@ -148,6 +155,13 @@ export class LiveQuery extends TxProcessor implements Client {
|
||||
if (this.client.getHierarchy().getDomain(_class) === DOMAIN_MODEL) {
|
||||
return await this.client.findOne(_class, query, options)
|
||||
}
|
||||
if (options?.projection !== undefined) {
|
||||
options.projection = {
|
||||
...options.projection,
|
||||
_class: 1,
|
||||
modifiedOn: 1
|
||||
}
|
||||
}
|
||||
const q = this.findQuery(_class, query, options) ?? this.createDumpQuery(_class, query, options)
|
||||
if (q.result instanceof Promise) {
|
||||
q.result = await q.result
|
||||
@ -255,6 +269,13 @@ export class LiveQuery extends TxProcessor implements Client {
|
||||
callback: (result: FindResult<T>) => void,
|
||||
options?: FindOptions<T>
|
||||
): () => void {
|
||||
if (options?.projection !== undefined) {
|
||||
options.projection = {
|
||||
...options.projection,
|
||||
_class: 1,
|
||||
modifiedOn: 1
|
||||
}
|
||||
}
|
||||
const q =
|
||||
this.getQuery(_class, query, callback as (result: Doc[]) => void, options) ??
|
||||
this.createQuery(_class, query, callback, options)
|
||||
|
@ -70,7 +70,7 @@
|
||||
}
|
||||
targets.clear()
|
||||
const baseObjects = await client.findAll(filter.key._class, space ? { space } : {}, {
|
||||
projection: { [filter.key.key]: 1 }
|
||||
projection: { [filter.key.key]: 1, space: 1 }
|
||||
})
|
||||
for (const object of baseObjects) {
|
||||
const value = getObjectValue(filter.key.key, object) ?? undefined
|
||||
|
@ -64,7 +64,7 @@
|
||||
{ ...resultQuery, ...(space ? { space } : {}) },
|
||||
{
|
||||
sort: { [filter.key.key]: SortingOrder.Ascending },
|
||||
projection: { [prefix + filter.key.key]: 1 }
|
||||
projection: { [prefix + filter.key.key]: 1, space: 1 }
|
||||
}
|
||||
)
|
||||
const res = await objectsPromise
|
||||
|
Loading…
Reference in New Issue
Block a user