Question Creation Utility (utils/createQuestion.ts)

platform · plugins/questions-resources/src/utils/createQuestion.ts · typescript · EPL-2.0
crm, integration, realtime, lang:typescript, tag:questions, tag:tx, tag:utility, tag:hcengineering

Creates and attaches question documents to parent records in collaborative workspaces. Reuse for implementing Q&A or feedback features tied to domain entities.

// Source: https://github.com/hcengineering/platform | License: EPL-2.0 | Modified files must remain under EPL-2.0
// Modifications to this file must remain under EPL-2.0.
// Provided via justclaw.it.com; keep this notice with the code.
//
// Copyright @ 2024 Hardcore Engineering Inc.
//

import type { Question } from '@hcengineering/questions'
import { type AttachedData, type Class, type Doc, type Ref, type Space, type TxOperations } from '@hcengineering/core'
import { getCurrentEmployeeRef } from './getCurrentEmployeeRef'

export type CreateQuestionData<Q extends Question<any>> = Omit<AttachedData<Q>, 'owner' | 'releasedBy' | 'releasedOn'>

export async function createQuestion<Parent extends Doc, Q extends Question<any>> (
  client: TxOperations,
  classRef: Ref<Class<Q>>,
  space: Ref<S

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key