import { Schema, Document } from 'mongoose' import db from '../service/db' export interface IUSmartgroupModel extends Document { _id: string name: string } const LANES = [ 'sprint', 'subtask', 'executor', 'stage', 'priority', 'isDone', 'taskType', 'rating', 'storyPoint' ] const ViewSchema = new Schema({ type: { type: String, enum: ['table', 'time', 'kanban'], required: true }, vertical: { type: String, enum: LANES }, horizontal: { type: String, enum: LANES } }) const smartgroup = new Schema({ name: { type: String, required: true, maxlength: 100 }, type: { type: String, enum: ['story', 'sprint', 'bug'] }, description: { type: String, default: '', maxlength: 500 }, view: ViewSchema, filter: { type: String, maxlength: 2000, required: true }, _projectId: { type: Schema.Types.ObjectId, ref: 'Project', required: true }, _creatorId: { type: Schema.Types.ObjectId, ref: 'User', required: true }, created: { type: Date, default: Date.now }, updated: { type: Date, default: Date.now } }) export const SmartgroupModel = db.model('Smartgroup', smartgroup)