cardAdmin.js 640 B

123456789101112131415161718
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const moment = require('moment');
  4. const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
  5. const { ObjectId } = require('mongoose').Types;
  6. // 工牌账号缓存
  7. const cardAdmin = {
  8. uid: { type: String }, // 工牌账号id
  9. uKey: { type: String }, // 工牌账号授权码
  10. remark: { type: String },
  11. };
  12. const schema = new Schema(cardAdmin, { toJSON: { virtuals: true } });
  13. schema.index({ 'meta.createdAt': 1 });
  14. schema.plugin(metaPlugin);
  15. module.exports = app => {
  16. const { mongoose } = app;
  17. return mongoose.model('CardAdmin', schema, 'card_admin');
  18. };