mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-10 11:47:42 +02:00
Improve TxOperations API (#809)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
@@ -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>
|
||||
|
||||
|
||||
@@ -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 })
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user