import { Schema, Document } from 'mongoose' import db from '../service/db' export interface IUCustomfieldModel extends Document { _id: string name: string choices: Array<{ _id: string value: string }> } const customfield = new Schema( { name: { type: String, maxlength: 100, required: true }, type: { type: String, required: true }, // 需求类型子类型 subtype: { type: String, }, // 外部数据地址 externalUrl: { type: String, maxlength: 2000 }, _creatorId: { type: Schema.Types.ObjectId }, _projectId: { type: Schema.Types.ObjectId }, _organizationId: Schema.Types.ObjectId, boundType: String, // 不支持修改 choices: [new Schema({ value: { type: String, maxlength: 100, required: true } })], created: { type: Date, default: Date.now }, updated: { type: Date, default: Date.now }, displayed: { type: Boolean, default: false }, _roleIds: { type: Array, default: [] }, // 无权限 roleId 列表 categoryIds: { type: Array, default: [] }, description: { type: String, maxlength: 500, default: '' }, _advancedCustomfieldId: String } ) export default db.model('Customfield', customfield)