Fix modifiedOn collection inner tx (#1504)

Signed-off-by: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com>
This commit is contained in:
Denis Bykhov 2022-04-24 11:13:30 +06:00 committed by GitHub
parent 34ddd0cb6c
commit a45fecaf69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,7 +13,7 @@
// limitations under the License. // limitations under the License.
// //
import core, { Doc, ServerStorage, Timestamp, Tx, TxCreateDoc } from '@anticrm/core' import core, { AttachedDoc, Doc, ServerStorage, Timestamp, Tx, TxCollectionCUD, TxCreateDoc } from '@anticrm/core'
import { Middleware, SessionContext, TxMiddlewareResult } from '@anticrm/server-core' import { Middleware, SessionContext, TxMiddlewareResult } from '@anticrm/server-core'
import { BaseMiddleware } from './base' import { BaseMiddleware } from './base'
@ -37,6 +37,10 @@ export class ModifiedMiddleware extends BaseMiddleware implements Middleware {
createTx.attributes.createOn = tx.modifiedOn createTx.attributes.createOn = tx.modifiedOn
} }
} }
if (this.storage.hierarchy.isDerived(tx._class, core.class.TxCollectionCUD)) {
const coltx = tx as TxCollectionCUD<Doc, AttachedDoc>
coltx.tx.modifiedOn = tx.modifiedOn
}
const res = await this.provideTx(ctx, tx) const res = await this.provideTx(ctx, tx)
return [res[0], res[1], res[2]] return [res[0], res[1], res[2]]
} }