From 3caa95e1e21a220612887e1069a3669687cd2dbe Mon Sep 17 00:00:00 2001 From: Felix Haase Date: Fri, 1 Mar 2024 22:41:15 +0100 Subject: [PATCH] chore(playground): add article component with blocks element Adds a new content type with the new blocks rich text format --- .../content-types/blocks-article/schema.json | 62 +++++++++++++++++++ .../controllers/blocks-article.js | 9 +++ .../blocks-article/routes/blocks-article.js | 9 +++ .../blocks-article/services/blocks-article.js | 9 +++ 4 files changed, 89 insertions(+) create mode 100644 playground/src/api/blocks-article/content-types/blocks-article/schema.json create mode 100644 playground/src/api/blocks-article/controllers/blocks-article.js create mode 100644 playground/src/api/blocks-article/routes/blocks-article.js create mode 100644 playground/src/api/blocks-article/services/blocks-article.js diff --git a/playground/src/api/blocks-article/content-types/blocks-article/schema.json b/playground/src/api/blocks-article/content-types/blocks-article/schema.json new file mode 100644 index 00000000..acfee8fb --- /dev/null +++ b/playground/src/api/blocks-article/content-types/blocks-article/schema.json @@ -0,0 +1,62 @@ +{ + "kind": "collectionType", + "collectionName": "blocks_articles", + "info": { + "singularName": "blocks-article", + "pluralName": "blocks-articles", + "displayName": "BlocksArticle", + "description": "" + }, + "options": { + "draftAndPublish": true + }, + "pluginOptions": { + "i18n": { + "localized": true + } + }, + "attributes": { + "Title": { + "type": "string", + "pluginOptions": { + "i18n": { + "localized": true + }, + "translate": { + "translate": "translate" + } + } + }, + "Content": { + "type": "blocks", + "pluginOptions": { + "i18n": { + "localized": true + }, + "translate": { + "translate": "translate" + } + } + }, + "writer": { + "type": "relation", + "relation": "oneToOne", + "target": "api::writer.writer", + "pluginOptions": { + "translate": { + "translate": "translate" + } + } + }, + "category": { + "type": "relation", + "relation": "oneToOne", + "target": "api::category.category", + "pluginOptions": { + "translate": { + "translate": "translate" + } + } + } + } +} diff --git a/playground/src/api/blocks-article/controllers/blocks-article.js b/playground/src/api/blocks-article/controllers/blocks-article.js new file mode 100644 index 00000000..0b7065ca --- /dev/null +++ b/playground/src/api/blocks-article/controllers/blocks-article.js @@ -0,0 +1,9 @@ +'use strict'; + +/** + * blocks-article controller + */ + +const { createCoreController } = require('@strapi/strapi').factories; + +module.exports = createCoreController('api::blocks-article.blocks-article'); diff --git a/playground/src/api/blocks-article/routes/blocks-article.js b/playground/src/api/blocks-article/routes/blocks-article.js new file mode 100644 index 00000000..bd972f73 --- /dev/null +++ b/playground/src/api/blocks-article/routes/blocks-article.js @@ -0,0 +1,9 @@ +'use strict'; + +/** + * blocks-article router + */ + +const { createCoreRouter } = require('@strapi/strapi').factories; + +module.exports = createCoreRouter('api::blocks-article.blocks-article'); diff --git a/playground/src/api/blocks-article/services/blocks-article.js b/playground/src/api/blocks-article/services/blocks-article.js new file mode 100644 index 00000000..7c9e081d --- /dev/null +++ b/playground/src/api/blocks-article/services/blocks-article.js @@ -0,0 +1,9 @@ +'use strict'; + +/** + * blocks-article service + */ + +const { createCoreService } = require('@strapi/strapi').factories; + +module.exports = createCoreService('api::blocks-article.blocks-article');