|
@@ -5,20 +5,21 @@ const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
|
|
|
|
|
|
// 案例
|
|
|
const cases = {
|
|
|
- name: { type: String, required: false, zh: '名称' }, //
|
|
|
- brief: { type: String, required: false, zh: '简介' }, //
|
|
|
+ title: { type: String, required: false, zh: '名称' }, //
|
|
|
+ origin: { type: String, required: false, default: '系统管理员', zh: '来源' }, //
|
|
|
create_time: { type: String, required: false, zh: '时间' }, //
|
|
|
- img_url: { type: String, required: false, zh: '图片' }, //
|
|
|
- file_url: { type: String, required: false, zh: '文件' }, //
|
|
|
+ brief: { type: String, required: false, zh: '简介' }, //
|
|
|
+ img_url: { type: Array, required: false, zh: '图片' }, //
|
|
|
+ file_url: { type: Array, required: false, zh: '文件' }, //
|
|
|
content: { type: String, required: false, zh: '内容' }, //
|
|
|
is_use: { type: String, required: false, default: '0', zh: '是否启用' }, // 字典表:is_use
|
|
|
};
|
|
|
const schema = new Schema(cases, { toJSON: { getters: true, virtuals: true } });
|
|
|
schema.index({ id: 1 });
|
|
|
schema.index({ 'meta.createdAt': 1 });
|
|
|
-schema.index({ name: 1 });
|
|
|
-schema.index({ brief: 1 });
|
|
|
+schema.index({ title: 1 });
|
|
|
schema.index({ create_time: 1 });
|
|
|
+schema.index({ brief: 1 });
|
|
|
schema.index({ is_use: 1 });
|
|
|
|
|
|
schema.plugin(metaPlugin);
|
|
@@ -27,3 +28,4 @@ module.exports = app => {
|
|
|
const { mongoose } = app;
|
|
|
return mongoose.model('Cases', schema, 'cases');
|
|
|
};
|
|
|
+
|