1234567891011121314151617181920212223242526272829 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- const { ObjectId } = require('mongoose').Types;
- // 打赏信息表
- const DoctormoneySchema = {
- doctorid: { type: ObjectId, required: true, maxLength: 200 }, // 医生id
- doctorname: { type: String, required: true, maxLength: 500 }, // 医生名称
- patientid: { type: ObjectId, required: true, maxLength: 200 }, // 患者ID
- patientname: { type: String, required: true, maxLength: 200 }, // 患者名称
- target_id: { type: ObjectId, required: true }, // 打赏目标(说的话)id
- content: { type: String }, // 打赏目标(说的话的内容)
- contenttype: { type: String }, // 说的话的内容的类型
- sendtime: { type: String, required: false }, // 发送时间
- money: { type: String, required: false, maxLength: 200 }, // 打赏金额
- orderno: { type: String, required: false, maxLength: 200 }, // 订单号
- type: { type: String, required: false }, // 类别;
- };
- const schema = new Schema(DoctormoneySchema, { toJSON: { virtuals: true } });
- schema.index({ doctorid: 1 });
- schema.index({ 'meta.createdAt': 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Doctormoney', schema, 'doctormoney');
- };
|