import { Schema, Document } from 'mongoose' import db from '../service/db' export interface IUTaskflowModel extends Document { _id: string name: string } const taskflow = new Schema({ name: { type: String, required: true, es_indexed: true, maxlength: 100 }, _boundToObjectId: { type: Schema.Types.ObjectId, required: true }, boundToObjectType: { type: String, required: true, enum: ['project', 'organization'] }, _creatorId: { type: Schema.Types.ObjectId, ref: 'User', required: true }, isDeleted: { type: Boolean, es_indexed: true, default: false }, created: { type: Date, default: Date.now, es_indexed: true }, updated: { type: Date, default: Date.now, es_indexed: true } }) export const TaskflowModel = db.model('Taskflow', taskflow)