kjzl_medium.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const moment = require('moment');
  4. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  5. const { ObjectId } = require('mongoose').Types;
  6. const { Secret } = require('naf-framework-mongoose/lib/model/schema');
  7. // 科教之旅-机构表
  8. const kjzl_medium = {
  9. name: { type: String }, // 名称
  10. contact: { type: String }, // 联系人
  11. phone: { type: String }, // 联系电话
  12. addr: { type: String }, // 地址
  13. belong: { type: String }, // 所属:中科/吉科
  14. password: { type: Secret, required: true, select: false }, // 登录密码
  15. openid: { type: String }, // 微信openid
  16. natural: { type: String }, // 资质
  17. achieve: { type: String }, // 成果
  18. condition: { type: String }, // 条件
  19. team: { type: String }, // 团队
  20. img_file: { type: Array }, // 图片
  21. project: { type: Array }, // 服务项目
  22. equipment: { type: Array }, // 设备共享
  23. remark: { type: String },
  24. };
  25. const schema = new Schema(kjzl_medium, { toJSON: { virtuals: true } });
  26. schema.index({ id: 1 });
  27. schema.index({ name: 1 });
  28. schema.index({ contact: 1 });
  29. schema.index({ phone: 1 });
  30. schema.index({ addr: 1 });
  31. schema.index({ belong: 1 });
  32. schema.index({ openid: 1 });
  33. schema.index({ 'meta.createdAt': 1 });
  34. schema.plugin(metaPlugin);
  35. module.exports = app => {
  36. const { mongoose } = app;
  37. return mongoose.model('Kjzl_medium', schema, 'kjzl_medium');
  38. };