Explorar el Código

修改金额插件

lrf hace 2 años
padre
commit
ba48a8199b
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. 2 2
      lib/model/type-money-plugin.js

+ 2 - 2
lib/model/type-money-plugin.js

@@ -1,9 +1,9 @@
 'use strict';
 const { Decimal128 } = require('mongoose').Types;
-module.exports = exports = params =>
+module.exports = exports = ({ key = 'money', ...params }) =>
   function metaPlugin(schema /* , options*/) {
     schema.add({
-      money: {
+      [key]: {
         type: Decimal128,
         set(data) {
           return data;