billApply.js 976 B

1234567891011121314151617181920212223
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
  4. // 提现申请
  5. const billApply = {
  6. school_id: { type: String, required: false, zh: '学校id', ref: 'School', getProp: [ 'name' ] }, //
  7. coach_id: { type: String, required: false, zh: '教练id', ref: 'Coach', getProp: [ 'name' ] }, //
  8. salary: { type: Number, required: false, zh: '提现金额' }, //
  9. reason: { type: String, required: false, zh: '原因' }, //
  10. result: { type: String, required: false, default: '0', zh: '审核结果' }, // 0:未审核;1审核成功;2:审核失败
  11. };
  12. const schema = new Schema(billApply, { toJSON: { virtuals: true } });
  13. schema.index({ id: 1 });
  14. schema.index({ 'meta.createdAt': 1 });
  15. schema.index({ school_id: 1 });
  16. schema.index({ coach_id: 1 });
  17. schema.plugin(metaPlugin);
  18. module.exports = app => {
  19. const { mongoose } = app;
  20. return mongoose.model('BillApply', schema, 'billApply');
  21. };