From c0554e85716a5a19cf9e282eeba965ca14af88db Mon Sep 17 00:00:00 2001 From: Erin Dachtler Date: Thu, 12 Jul 2018 12:37:19 -0700 Subject: [PATCH 1/4] Fix for JSON attribute types in GraphQL Fixes #1476 --- packages/strapi-plugin-graphql/services/GraphQL.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/strapi-plugin-graphql/services/GraphQL.js b/packages/strapi-plugin-graphql/services/GraphQL.js index 29f646ca2a..f5ba06b29f 100644 --- a/packages/strapi-plugin-graphql/services/GraphQL.js +++ b/packages/strapi-plugin-graphql/services/GraphQL.js @@ -167,6 +167,9 @@ module.exports = { case 'float': type = 'Float'; break; + case 'json': + type = 'JSON'; + break; case 'enumeration': type = this.convertEnumType(definition, modelName, attributeName); break; From aba7de44ce99ab90724af8b8a983252f84302a1d Mon Sep 17 00:00:00 2001 From: Jim LAURIE Date: Fri, 20 Jul 2018 15:09:14 +0200 Subject: [PATCH 2/4] Fix delete uploaded file SQL fix #1459 --- packages/strapi-plugin-upload/services/Upload.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/strapi-plugin-upload/services/Upload.js b/packages/strapi-plugin-upload/services/Upload.js index cef660041e..1b28422278 100644 --- a/packages/strapi-plugin-upload/services/Upload.js +++ b/packages/strapi-plugin-upload/services/Upload.js @@ -101,6 +101,8 @@ module.exports = { }, remove: async (params, config) => { + params.id = (params._id || params.id); + const file = await strapi.plugins['upload'].services.upload.fetch(params); // get upload provider settings to configure the provider to use @@ -116,7 +118,6 @@ module.exports = { // Use Content Manager business logic to handle relation. if (strapi.plugins['content-manager']) { params.model = 'file'; - params.id = (params._id || params.id); await strapi.plugins['content-manager'].services['contentmanager'].delete(params, {source: 'upload'}); } From 83b032e9b360c106557a1286fc552f09058fa0c3 Mon Sep 17 00:00:00 2001 From: Jim LAURIE Date: Fri, 20 Jul 2018 17:20:06 +0200 Subject: [PATCH 3/4] Fix udpate file SQL via content manager fix #1461 --- packages/strapi-hook-bookshelf/lib/relations.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/packages/strapi-hook-bookshelf/lib/relations.js b/packages/strapi-hook-bookshelf/lib/relations.js index 57ab4bf757..4b3083bad9 100644 --- a/packages/strapi-hook-bookshelf/lib/relations.js +++ b/packages/strapi-hook-bookshelf/lib/relations.js @@ -10,15 +10,17 @@ const _ = require('lodash'); // Utils const { models: { getValuePrimaryKey } } = require('strapi-utils'); -const transformToArrayID = (array) => { +const transformToArrayID = (array, association) => { if(_.isArray(array)) { - return array.map(value => { + array = array.map(value => { if (_.isPlainObject(value)) { - return value._id || value.id; + return value._id || value.id || false; } return value; }); + + return array.filter(n => n); } if (association.type === 'model' || (association.type === 'collection' && _.isObject(array))) { @@ -140,8 +142,8 @@ module.exports = { case 'manyToMany': if (response[current] && _.isArray(response[current]) && current !== 'id') { // Compare array of ID to find deleted files. - const currentValue = transformToArrayID(response[current]).map(id => id.toString()); - const storedValue = transformToArrayID(params.values[current]).map(id => id.toString()); + const currentValue = transformToArrayID(response[current], association).map(id => id.toString()); + const storedValue = transformToArrayID(params.values[current], association).map(id => id.toString()); const toAdd = _.difference(storedValue, currentValue); const toRemove = _.difference(currentValue, storedValue); @@ -229,8 +231,8 @@ module.exports = { case 'oneToManyMorph': case 'manyToManyMorph': { // Compare array of ID to find deleted files. - const currentValue = transformToArrayID(response[current]).map(id => id.toString()); - const storedValue = transformToArrayID(params.values[current]).map(id => id.toString()); + const currentValue = transformToArrayID(response[current], association).map(id => id.toString()); + const storedValue = transformToArrayID(params.values[current], association).map(id => id.toString()); const toAdd = _.difference(storedValue, currentValue); const toRemove = _.difference(currentValue, storedValue); From a2c9de74f0ce580a71990c75d71c245cfa4f5c82 Mon Sep 17 00:00:00 2001 From: Comical DERSKEAL <27731088+derskeal@users.noreply.github.com> Date: Fri, 20 Jul 2018 18:44:19 +0100 Subject: [PATCH 4/4] Update configurations.md --- docs/3.x.x/en/configurations/configurations.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/3.x.x/en/configurations/configurations.md b/docs/3.x.x/en/configurations/configurations.md index ced94dd32b..01f3bcb751 100644 --- a/docs/3.x.x/en/configurations/configurations.md +++ b/docs/3.x.x/en/configurations/configurations.md @@ -1,6 +1,6 @@ # Configurations -The main configurations of the project are located in the `./config` directory. Additional configs can be added in the `./api/**/config` folder of each APIs and plugins by creating JavaScript or JSON files. +The main configurations of the project are located in the `./config` directory. Additional configs can be added in the `./api/**/config` folder of each API and plugin by creating JavaScript or JSON files. ## Application @@ -153,7 +153,7 @@ Each JSON file located in the folder must have the name of its corresponding tra Most of the application's configurations are defined by environment. It means that you can specify settings for each environment (`development`, `production`, `test`, etc.). -> Note: You can access to the config of the current environment through `strapi.config.currentEnvironment`. +> Note: You can access the config of the current environment through `strapi.config.currentEnvironment`. ***