1234567891011121314151617181920212223 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
- // 店铺收藏
- const storeShop = {
- customer: { type: String, required: false, zh: '顾客', ref: 'User.User' }, //
- shop: { type: String, required: false, zh: '店铺', ref: 'Shop.Shop' }, //
- time: { type: String, required: false, zh: '时间' }, //
- };
- const schema = new Schema(storeShop, { toJSON: { getters: true, virtuals: true } });
- schema.index({ id: 1 });
- schema.index({ 'meta.createdAt': 1 });
- schema.index({ customer: 1 });
- schema.index({ shop: 1 });
- schema.index({ time: 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('StoreShop', schema, 'storeShop');
- };
|