import { Schema, Document } from 'mongoose' import db from '../service/db' export interface IUStageModel extends Document { _id: string name: string } const stage = new Schema({ name: { type: String, required: true, es_indexed: true, maxlength: 100 }, _projectId: { type: Schema.Types.ObjectId, ref: 'Project', required: true }, _tasklistId: { type: Schema.Types.ObjectId, ref: 'Tasklist', required: true }, _creatorId: { type: Schema.Types.ObjectId, ref: 'User', required: true }, created: { type: Date, default: Date.now }, updated: { type: Date, default: Date.now }, isFirst: { type: Boolean, default: false }, _nextId: { type: Schema.Types.ObjectId, ref: 'Stage', default: null }, isArchived: { type: String, default: null } }) export const StageModel = db.model('Stage', stage)