1234567891011121314151617 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- // 企业信息
- const CompanySchema = {
- company: { type: String, required: true, maxLength: 200 }, // 名称
- mobile: { type: String, required: false, maxLength: 500 }, // 电话
- };
- const schema = new Schema(CompanySchema, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Company', schema, 'company');
- };
|