meta-plugin.js 325 B

12345678910
  1. 'use strict';
  2. module.exports = exports = function metaPlugin(schema/* , options*/) {
  3. schema.add({
  4. meta: {
  5. state: { type: Number, default: 0 }, // 数据状态: 0-正常;1-标记删除
  6. comment: String,
  7. } });
  8. schema.set('timestamps', { createdAt: 'meta.createdAt', updatedAt: 'meta.updatedAt' });
  9. };