presentrcord.js 956 B

123456789101112131415161718192021
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. const PresentRecord = {
  5. owner_id: { type: String, required: true, maxLength: 200 }, // 播主id
  6. owner_name: { type: String, required: true, maxLength: 200 }, // 播主名称
  7. sender_id: { type: String, required: true, maxLength: 200 }, // 赠送人id
  8. sender_name: { type: String, required: true, maxLength: 200 }, // 赠送人名称
  9. present_id: { type: String, required: true, maxLength: 200 }, // 礼物id
  10. present_name: { type: String, required: true, maxLength: 200 }, // 礼物名称
  11. price: { type: String, required: true, maxLength: 200 }, // 金额
  12. };
  13. const schema = new Schema(PresentRecord, { toJSON: { virtuals: true } });
  14. schema.index({ id: 1 });
  15. schema.plugin(metaPlugin);
  16. module.exports = app => {
  17. const { mongoose } = app;
  18. return mongoose.model('PresentRecord', schema, 'present_record');
  19. };