12345678910111213141516171819202122232425262728293031 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- // 图片路径
- const image = new Schema({
- url: { type: String, required: false, maxLength: 500 }, // 图片路径
- });
- // 轮播图
- const BusinessSchema = {
- company: { type: String, required: true, maxLength: 200 }, // 名称
- engCompany: { type: String, required: true, maxLength: 200 }, // 文件路径
- brief: { type: String, required: true, maxLength: 200 }, // 创建时间
- imagearray: { type: [ image ], select: true, maxLength: 500 }, // 图片(数组)
- mobile: { type: String, required: true, maxLength: 500 }, // 创建时间
- address: { type: String, required: true, maxLength: 500 }, // 创建时间
- weixin: { type: String, required: true, maxLength: 500 }, // 创建时间
- gzh: { type: String, required: true, maxLength: 500 }, // 创建时间
- weibo: { type: String, required: true, maxLength: 500 }, // 创建时间
- beian: { type: String, required: true, maxLength: 500 }, // 创建时间
- };
- const schema = new Schema(BusinessSchema, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Business', schema, 'business');
- };
|