/
dimamir
/
undb
Обзор
Документация
Войти
/
dimamir
/
undb
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
packages/domain/src/command.ts
25 строк
732 B
nichenqin
chore: prettier
14 май 2024, 04:57
14 май 2024, 04:57
5c0eb73
Код
Авторство
О чём код?
import { v4 } from "uuid" export type CommandProps<T> = Omit<T, "correlationId" | "commandId"> & Partial<Command> export abstract class Command { /** * Command id, in case if we want to save it * for auditing purposes and create a correlation/causation chain */ public readonly commandId: string /** ID for correlation purposes (for commands that * arrive from other microservices,logs correlation, etc). */ public readonly correlationId: string /** * Causation id to reconstruct execution order if needed */ public readonly causationId?: string constructor(props: CommandProps<unknown>) { this.correlationId = props.correlationId ?? v4() this.commandId = props.commandId ?? v4() } }