|
@@ -2,17 +2,15 @@
|
|
|
const Schema = require('mongoose').Schema;
|
|
|
const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
|
|
|
|
|
|
-const MoneyPlugin = require('naf-framework-mongoose-free/lib/model/type-money-plugin');
|
|
|
-
|
|
|
// 商品信息
|
|
|
const goods = {
|
|
|
shop: { type: String, required: false, zh: '店铺', ref: 'Shop.Shop' }, //
|
|
|
name: { type: String, required: false, zh: '商品名称' }, //
|
|
|
shot_brief: { type: String, required: false, zh: '简短简介' }, // 长度在50以内
|
|
|
send_time: { type: String, required: false, zh: '发货时间' }, //
|
|
|
- specs: { type: Array, required: false, zh: '规格' }, // {规格名:[候选规格]}
|
|
|
brief: { type: String, required: false, zh: '商品介绍' }, //
|
|
|
file: { type: Array, required: false, zh: '商品图片' }, //
|
|
|
+ tags: { type: Array, required: false, zh: '商品标签' }, //
|
|
|
status: { type: String, required: false, default: '0', zh: '商品状态' }, // 字典:goods_status
|
|
|
};
|
|
|
const schema = new Schema(goods, { toJSON: { getters: true, virtuals: true } });
|
|
@@ -23,9 +21,6 @@ schema.index({ name: 1 });
|
|
|
schema.index({ status: 1 });
|
|
|
|
|
|
schema.plugin(metaPlugin);
|
|
|
-schema.plugin(MoneyPlugin({ zh: '实际销售价格', required: false, key: 'sell_money' }));
|
|
|
-schema.plugin(MoneyPlugin({ zh: '划掉销售价格', required: false, key: 'flow_money' }));
|
|
|
-schema.plugin(MoneyPlugin({ zh: '运费', required: false, key: 'freight' }));
|
|
|
|
|
|
module.exports = app => {
|
|
|
const { mongoose } = app;
|