setting.js 708 B

123456789101112131415161718192021
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const moment = require('moment');
  4. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  5. const { ObjectId } = require('mongoose').Types;
  6. // 设置表
  7. const setting = {
  8. name: { type: String }, // 本馆名称
  9. time: { type: Array }, // 营业时间
  10. images: { type: Array }, // 宣传图
  11. brief: { type: String }, // 简介
  12. remark: { type: String },
  13. };
  14. const schema = new Schema(setting, { toJSON: { virtuals: true } });
  15. schema.index({ id: 1 });
  16. schema.index({ 'meta.createdAt': 1 });
  17. schema.plugin(metaPlugin);
  18. module.exports = app => {
  19. const { mongoose } = app;
  20. return mongoose.model('Setting', schema, 'setting');
  21. };