import { Schema } from 'mongoose'; import type { Ablauf } from './ablaeufe.dto'; export interface AblaeufeDocument { anlageId: string; revision: number; workflows: Ablauf[] } export const AblaeufeSchema = new Schema({ anlageId: { type: String, required: true, immutable: true }, revision: { type: Number, default: 0 }, workflows: { type: Schema.Types.Mixed, default: [] }, }, { collection: 'anlagen_ablaeufe', timestamps: true, strict: 'throw' }); AblaeufeSchema.index({ anlageId: 1 }, { unique: true });