mirror of
https://github.com/hcengineering/platform.git
synced 2026-10-20 06:51:38 +02:00
27 lines
640 B
TypeScript
27 lines
640 B
TypeScript
//
|
|
// Copyright @ 2024 Hardcore Engineering Inc.
|
|
//
|
|
|
|
import type { Question } from '@hcengineering/questions'
|
|
import { type DocumentUpdate, type TxOperations } from '@hcengineering/core'
|
|
import { canUpdateQuestion } from './canUpdateQuestion'
|
|
|
|
export async function updateQuestion<Q extends Question<unknown>> (
|
|
client: TxOperations,
|
|
question: Q,
|
|
update: DocumentUpdate<Q>
|
|
): Promise<void> {
|
|
if (!canUpdateQuestion(question)) {
|
|
return
|
|
}
|
|
await client.updateCollection(
|
|
question._class,
|
|
question.space,
|
|
question._id,
|
|
question.attachedTo,
|
|
question.attachedToClass,
|
|
question.collection,
|
|
update
|
|
)
|
|
}
|