Rating Queue Event Messages (src/types.ts)

platform · services/rating/src/types.ts · typescript · EPL-2.0
infra, lang:typescript, tag:backend, tag:events

Defines rating queue events and message structures for reindexing and calculation tasks. Reuse when implementing background rating queues.

// 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.
import type { Tx } from '@hcengineering/core'
import type { QueueTopic } from '@hcengineering/server-core'

export enum QueueRatingEvent {
  Reindex = 'reindex',
  Calculate = 'calc'
}

export const ratingQueue = 'rating' as QueueTopic

export interface QueueRatingMessage {
  type: QueueRatingEvent
}

export interface QueueCalculateMessage extends QueueRatingMessage {
  type: QueueRatingEvent.Calculate

  tx: Tx
}

export const ratingEvents = {
  reindex: (): QueueRatingMessage => ({
    type: QueueRatingEvent.Reindex
  }),
  calculate: (tx: Tx): QueueCalcu

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

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

Get a free API key