123456789101112131415161718192021 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- const { Secret } = require('naf-framework-mongoose/lib/model/schema');
- // 首页轮播管理表
- const BannerSchema = {
- name: { type: String, required: false, maxLength: 200 }, // 图片名称
- url: { type: String, required: true, maxLength: 200 }, // 图片路径
- order: { type: String, required: false, maxLength: 200 }, // 排序
- };
- const schema = new Schema(BannerSchema, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Banner', schema, 'banner');
- };
|