12345678910111213141516171819202122 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const moment = require('moment');
- const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
- const { ObjectId } = require('mongoose').Types;
- const relation = {
- role: { type: String }, // 角色信息
- level: { type: String }, // 账号等级
- };
- // 绩效设置表-关系表,只用model就行
- const achievementSetting = {
- relation: { type: Array }, // 角色与等级关系
- remark: { type: String },
- };
- const schema = new Schema(achievementSetting, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.index({ 'meta.createdAt': 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('AchievementSetting', schema, 'achievementSetting');
- };
|