mirror of
https://github.com/hcengineering/platform.git
synced 2025-01-08 21:27:45 +03:00
UBERF-4384: Update space from attributes (#4049)
Signed-off-by: Maxim Karmatskikh <mkarmatskih@gmail.com>
This commit is contained in:
parent
d2604f4f23
commit
133e750e9d
@ -303,4 +303,9 @@ function updateDoc2Elastic (
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const spaceKey = docKey('space', { _class: core.class.Doc })
|
||||
if (doc[spaceKey] !== undefined) {
|
||||
doc.space = doc[spaceKey]
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,8 @@ import core, {
|
||||
_getOperator,
|
||||
setObjectValue,
|
||||
toFindResult,
|
||||
versionToString
|
||||
versionToString,
|
||||
docKey
|
||||
} from '@hcengineering/core'
|
||||
import { DbAdapter } from '../adapter'
|
||||
import { RateLimitter } from '../limitter'
|
||||
@ -145,7 +146,7 @@ export class FullTextIndexPipeline implements FullTextPipeline {
|
||||
}
|
||||
}
|
||||
|
||||
updateDoc<T extends Doc>(doc: T, tx: DocumentUpdate<T>, updateDate: boolean): T {
|
||||
updateDoc (doc: DocIndexState, tx: DocumentUpdate<DocIndexState>, updateDate: boolean): DocIndexState {
|
||||
for (const key in tx) {
|
||||
if (key.startsWith('$')) {
|
||||
const operator = _getOperator(key)
|
||||
@ -154,6 +155,12 @@ export class FullTextIndexPipeline implements FullTextPipeline {
|
||||
setObjectValue(key, doc, (tx as any)[key])
|
||||
}
|
||||
}
|
||||
|
||||
const spaceKey = docKey('space', { _class: core.class.Doc })
|
||||
if (doc.attributes !== undefined && doc.attributes[spaceKey] !== undefined) {
|
||||
doc.space = doc.attributes[spaceKey]
|
||||
}
|
||||
|
||||
if (updateDate) {
|
||||
doc.modifiedBy = core.account.System
|
||||
doc.modifiedOn = Date.now()
|
||||
|
Loading…
Reference in New Issue
Block a user