Fix derived delete from collection (#2002)

Signed-off-by: Anna No <anna.no@xored.com>
This commit is contained in:
Anna No 2022-06-03 15:03:48 +07:00 committed by GitHub
parent 6bb8bf5e1b
commit 8c8ba5c86e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -333,15 +333,16 @@ class TServerStorage implements ServerStorage {
const factory = new TxFactory(core.account.System)
if (this.hierarchy.isDerived(object._class, core.class.AttachedDoc)) {
const adoc = object as AttachedDoc
const nestedTx = factory.createTxRemoveDoc(object._class, object.space, adoc._id) as TxRemoveDoc<AttachedDoc>
const nestedTx = factory.createTxRemoveDoc(adoc._class, adoc.space, adoc._id)
const tx = factory.createTxCollectionCUD(
adoc.attachedToClass,
adoc.attachedTo,
object.space,
adoc.space,
adoc.collection,
nestedTx
)
result.push(tx)
result.push(...(await this.processCollection(ctx, tx)))
} else {
result.push(factory.createTxRemoveDoc(object._class, object.space, object._id))
}