import { Schema, Document } from 'mongoose' import db from '../service/db' export interface IUApplicationModel extends Document { _id: string name: string applications?: any } const ApplicationSchema = new Schema( { name: { type: String, maxlength: 100, unique: true }, type: { type: Number, default: 0 }, title: { zh: { type: String, maxlength: 500, default: '' }, en: { type: String, maxlength: 500, default: '' } }, description: { zh: { type: String, maxlength: 500, default: '' }, en: { type: String, maxlength: 500, default: '' } }, status: { type: String, default: 'online', enum: ['online', 'offline'] }, created: { type: Date, default: Date.now }, updated: { type: Date, default: Date.now } }, { id: false, read: 'secondaryPreferred', toJSON: { versionKey: false, virtuals: false, getters: true } } ) export default db.model('Application', ApplicationSchema)