From 1dea89ca8f826ff3a3afee1406a2fa1e6855bca0 Mon Sep 17 00:00:00 2001 From: Alexandre Bodin Date: Tue, 23 Jul 2019 13:36:06 +0200 Subject: [PATCH] Support type wysiwyg instead of appearance param --- cypress/fixtures/api/product.json | 7 ++--- .../lib/buildDatabaseSchema.js | 1 + .../strapi-hook-mongoose/lib/utils/index.js | 1 + .../test/graphqlCrud.test.e2e.js | 5 +-- .../test/graphqlRelations.test.e2e.js | 15 ++------- test/helpers/generators.js | 31 ++----------------- 6 files changed, 10 insertions(+), 50 deletions(-) diff --git a/cypress/fixtures/api/product.json b/cypress/fixtures/api/product.json index f18b5cb2bae..269fd531e94 100644 --- a/cypress/fixtures/api/product.json +++ b/cypress/fixtures/api/product.json @@ -13,10 +13,7 @@ { "name": "description", "params": { - "type": "text", - "appearance": { - "WYSIWYG": false - } + "type": "text" } }, { @@ -56,4 +53,4 @@ } } ] -} \ No newline at end of file +} diff --git a/packages/strapi-hook-bookshelf/lib/buildDatabaseSchema.js b/packages/strapi-hook-bookshelf/lib/buildDatabaseSchema.js index e8068a4869d..9f2aaf83beb 100644 --- a/packages/strapi-hook-bookshelf/lib/buildDatabaseSchema.js +++ b/packages/strapi-hook-bookshelf/lib/buildDatabaseSchema.js @@ -365,6 +365,7 @@ const getType = ({ definition, attribute, name, tableExists = false }) => { switch (attribute.type) { case 'uuid': return client === 'pg' ? 'uuid' : 'varchar(36)'; + case 'wysiwyg': case 'text': return client === 'pg' ? 'text' : 'longtext'; case 'json': diff --git a/packages/strapi-hook-mongoose/lib/utils/index.js b/packages/strapi-hook-mongoose/lib/utils/index.js index a2d0dbdda19..f802a293307 100644 --- a/packages/strapi-hook-mongoose/lib/utils/index.js +++ b/packages/strapi-hook-mongoose/lib/utils/index.js @@ -55,6 +55,7 @@ module.exports = (mongoose = Mongoose) => { case 'password': case 'string': case 'text': + case 'wysiwyg': return 'String'; default: return undefined; diff --git a/packages/strapi-plugin-graphql/test/graphqlCrud.test.e2e.js b/packages/strapi-plugin-graphql/test/graphqlCrud.test.e2e.js index ab3342ab34c..7f68ecd4410 100644 --- a/packages/strapi-plugin-graphql/test/graphqlCrud.test.e2e.js +++ b/packages/strapi-plugin-graphql/test/graphqlCrud.test.e2e.js @@ -12,11 +12,8 @@ const postModel = { { name: 'name', params: { - appearance: { - WYSIWYG: false, - }, multiple: false, - type: 'string', + type: 'wysiwyg', }, }, { diff --git a/packages/strapi-plugin-graphql/test/graphqlRelations.test.e2e.js b/packages/strapi-plugin-graphql/test/graphqlRelations.test.e2e.js index 58249240893..ce452c2934d 100644 --- a/packages/strapi-plugin-graphql/test/graphqlRelations.test.e2e.js +++ b/packages/strapi-plugin-graphql/test/graphqlRelations.test.e2e.js @@ -16,21 +16,15 @@ const documentModel = { { name: 'name', params: { - appearance: { - WYSIWYG: false, - }, multiple: false, - type: 'string', + type: 'wysiwyg', }, }, { name: 'content', params: { - appearance: { - WYSIWYG: true, - }, multiple: false, - type: 'text', + type: 'wysiwyg', }, }, ], @@ -45,11 +39,8 @@ const labelModel = { { name: 'name', params: { - appearance: { - WYSIWYG: false, - }, multiple: false, - type: 'string', + type: 'wysiwyg', }, }, { diff --git a/test/helpers/generators.js b/test/helpers/generators.js index 653628a6ded..dce1bd77190 100644 --- a/test/helpers/generators.js +++ b/test/helpers/generators.js @@ -4,9 +4,6 @@ module.exports = { { name: 'title', params: { - appearance: { - WYSIWYG: false, - }, multiple: false, type: 'string', }, @@ -14,11 +11,8 @@ module.exports = { { name: 'content', params: { - appearance: { - WYSIWYG: true, - }, multiple: false, - type: 'text', + type: 'wysiwyg', }, }, { @@ -42,9 +36,6 @@ module.exports = { { name: 'name', params: { - appearance: { - WYSIWYG: false, - }, multiple: false, type: 'string', }, @@ -69,9 +60,6 @@ module.exports = { { name: 'name', params: { - appearance: { - WYSIWYG: false, - }, multiple: false, type: 'string', }, @@ -95,9 +83,6 @@ module.exports = { { name: 'name', params: { - appearance: { - WYSIWYG: false, - }, multiple: false, type: 'string', }, @@ -128,9 +113,6 @@ module.exports = { { name: 'name', params: { - appearance: { - WYSIWYG: false, - }, multiple: false, type: 'string', }, @@ -138,19 +120,13 @@ module.exports = { { name: 'description', params: { - appearance: { - WYSIWYG: true, - }, multiple: false, - type: 'text', + type: 'wysiwyg', }, }, { name: 'published', params: { - appearance: { - WYSIWYG: false, - }, multiple: false, type: 'boolean', }, @@ -166,9 +142,6 @@ module.exports = { { name: 'title', params: { - appearance: { - WYSIWYG: false, - }, multiple: false, type: 'string', },