client filtering model transactions

Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
Andrey Platov 2021-08-10 12:26:48 +02:00
parent daf7ea7208
commit 899e9e9f83
No known key found for this signature in database
GPG Key ID: C8787EFEB4B64AF0
2 changed files with 4 additions and 3 deletions

View File

@ -59,8 +59,9 @@ class ClientImpl implements Client {
async tx (tx: Tx): Promise<void> {
if (tx.objectSpace === core.space.Model) {
this.hierarchy.tx(tx)
await this.model.tx(tx)
}
await Promise.all([this.conn.tx(tx), this.model.tx(tx)])
await this.conn.tx(tx)
this.notify?.(tx)
}

View File

@ -44,14 +44,14 @@
const query = createQuery()
$: query.query(chunter.class.Backlink, { objectId: object._id }, result => { backlinks = result })
function save() {
async function save() {
const attributes: Record<string, any> = {}
for (const key in object) {
if ((newValue as any)[key] !== (object as any)[key]) {
attributes[key] = (newValue as any)[key]
}
}
client.updateDoc(recruit.class.Candidate, object.space, object._id, attributes)
await client.updateDoc(recruit.class.Candidate, object.space, object._id, attributes)
}
</script>