Comparing version 3.0.0 to 3.1.0
{ | ||
"name": "fast-fame", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"main": "src/index.js", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -78,3 +78,4 @@ const { Types } = require('mongoose'); | ||
execBefore && (await this.beforeCreate({ instance: data }, accessToken)); | ||
const sharedData = new Map(); | ||
execBefore && (await this.beforeCreate({ instance: data, sharedData }, accessToken)); | ||
@@ -97,3 +98,3 @@ if (!Array.isArray(data)) { | ||
execAfter && (await this.afterCreate({ instance, data }, accessToken)); | ||
execAfter && (await this.afterCreate({ instance, data, sharedData }, accessToken)); | ||
return instance; | ||
@@ -100,0 +101,0 @@ } |
@@ -45,21 +45,29 @@ const { fastify, isDev, routeHooks } = require('../server'); | ||
let type = 'object'; | ||
// array type check when 2 accepts are there in remote method and second type is array | ||
// have useBody enabled | ||
if ( | ||
accepts.length === 2 && | ||
accepts[0].arg === 'accessToken' && | ||
accepts[1].type === 'array' && | ||
accepts[1].useBody | ||
) { | ||
const acceptsLen = accepts.length; | ||
const lastAcceptsArg = accepts[acceptsLen - 1]; | ||
// array type check when last accept in remote method has type array & useBody enabled. | ||
if (lastAcceptsArg.type === 'array' && lastAcceptsArg.useBody) { | ||
type = 'array'; | ||
} else if ( | ||
// array type check when 1 accepts are there in remote method and type is array | ||
// have useBody enabled | ||
accepts.length === 1 && | ||
accepts[0].type === 'array' && | ||
accepts[0].useBody | ||
) { | ||
type = 'array'; | ||
} | ||
// array type check when 2 accepts are there in remote method and second type is array | ||
// have useBody enabled | ||
// if ( | ||
// accepts.length === 2 && | ||
// accepts[0].arg === 'accessToken' && | ||
// accepts[1].type === 'array' && | ||
// accepts[1].useBody | ||
// ) { | ||
// type = 'array'; | ||
// } else if ( | ||
// // array type check when 1 accepts are there in remote method and type is array | ||
// // have useBody enabled | ||
// accepts.length === 1 && | ||
// accepts[0].type === 'array' && | ||
// accepts[0].useBody | ||
// ) { | ||
// type = 'array'; | ||
// } | ||
schema.body = { | ||
@@ -66,0 +74,0 @@ type, |
61094
1899