Improve TxOperations API (#809)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev
2022-01-13 10:06:50 +01:00
committed by GitHub
parent 4f70d992e4
commit a2259c002b
15 changed files with 264 additions and 272 deletions
@@ -56,15 +56,7 @@
return
}
await client.updateCollection(
item._class,
item.space,
item._id,
item.attachedTo,
item.attachedToClass,
item.collection,
ops
)
await client.update(item, ops)
}
</script>
+3 -17
View File
@@ -52,17 +52,7 @@ async function editStatuses (object: SpaceWithStates): Promise<void> {
}
async function toggleDone (value: boolean, object: TodoItem): Promise<void> {
await getClient().updateCollection(
object._class,
object.space,
object._id,
object.attachedTo,
object.attachedToClass,
object.collection,
{
done: value
}
)
await getClient().update(object, { done: value })
}
async function ArchiveSpace (object: SpaceWithStates): Promise<void> {
@@ -78,9 +68,7 @@ async function ArchiveSpace (object: SpaceWithStates): Promise<void> {
const client = getClient()
// eslint-disable-next-line @typescript-eslint/no-floating-promises
client.updateDoc(object._class, object.space, object._id, {
archived: true
})
client.update(object, { archived: true })
}
}
)
@@ -99,9 +87,7 @@ async function UnarchiveSpace (object: SpaceWithStates): Promise<void> {
const client = getClient()
// eslint-disable-next-line @typescript-eslint/no-floating-promises
client.updateDoc(object._class, object.space, object._id, {
archived: false
})
client.update(object, { archived: false })
}
}
)