mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-22 08:20:39 +00: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,
|
_getOperator,
|
||||||
setObjectValue,
|
setObjectValue,
|
||||||
toFindResult,
|
toFindResult,
|
||||||
versionToString
|
versionToString,
|
||||||
|
docKey
|
||||||
} from '@hcengineering/core'
|
} from '@hcengineering/core'
|
||||||
import { DbAdapter } from '../adapter'
|
import { DbAdapter } from '../adapter'
|
||||||
import { RateLimitter } from '../limitter'
|
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) {
|
for (const key in tx) {
|
||||||
if (key.startsWith('$')) {
|
if (key.startsWith('$')) {
|
||||||
const operator = _getOperator(key)
|
const operator = _getOperator(key)
|
||||||
@ -154,6 +155,12 @@ export class FullTextIndexPipeline implements FullTextPipeline {
|
|||||||
setObjectValue(key, doc, (tx as any)[key])
|
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) {
|
if (updateDate) {
|
||||||
doc.modifiedBy = core.account.System
|
doc.modifiedBy = core.account.System
|
||||||
doc.modifiedOn = Date.now()
|
doc.modifiedOn = Date.now()
|
||||||
|
Loading…
Reference in New Issue
Block a user