Signed-off-by: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com>
This commit is contained in:
Denis Bykhov 2022-03-11 15:05:03 +06:00 committed by GitHub
parent 178105c657
commit 173c062369
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -160,15 +160,19 @@ class TServerStorage implements ServerStorage {
const baseClass = this.hierarchy.getBaseClass(_class) const baseClass = this.hierarchy.getBaseClass(_class)
if (baseClass !== _class) { if (baseClass !== _class) {
// Mixin opeeration is required. // Mixin opeeration is required.
return [txFactory.createTxMixin(_id, attachedTo._class, attachedTo.space, _class, { const tx = txFactory.createTxMixin(_id, attachedTo._class, attachedTo.space, _class, {
$inc: { [colTx.collection]: isCreateTx ? 1 : -1 } $inc: { [colTx.collection]: isCreateTx ? 1 : -1 }
})] })
tx.modifiedOn = colTx.modifiedOn
return [tx]
} else { } else {
return [ const tx = txFactory.createTxUpdateDoc(_class, attachedTo.space, _id, {
txFactory.createTxUpdateDoc(_class, attachedTo.space, _id, { $inc: { [colTx.collection]: isCreateTx ? 1 : -1 }
$inc: { [colTx.collection]: isCreateTx ? 1 : -1 } })
}) tx.modifiedOn = colTx.modifiedOn
]
return [tx]
} }
} }
} }
@ -198,7 +202,7 @@ class TServerStorage implements ServerStorage {
const _class = txClass(tx) const _class = txClass(tx)
const objClass = txObjectClass(tx) const objClass = txObjectClass(tx)
return await ctx.with('tx', { _class, objClass }, async (ctx) => { return await ctx.with('tx', { _class, objClass }, async (ctx) => {
if (tx.objectSpace !== core.space.DerivedTx) { if (tx.space !== core.space.DerivedTx) {
await ctx.with('domain-tx', { _class, objClass }, async () => await this.getAdapter(DOMAIN_TX).tx(tx)) await ctx.with('domain-tx', { _class, objClass }, async () => await this.getAdapter(DOMAIN_TX).tx(tx))
} }