From efa89313fa4152252b477aafd88f7cf4a66747d8 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Thu, 5 Feb 2026 10:19:56 +0000 Subject: Initial Strapi plugin project --- .../category/content-types/category/schema.json | 31 ++++++++++++++++++++++ .../src/api/category/controllers/category.ts | 7 +++++ playground/src/api/category/routes/category.ts | 7 +++++ playground/src/api/category/services/category.ts | 7 +++++ 4 files changed, 52 insertions(+) create mode 100644 playground/src/api/category/content-types/category/schema.json create mode 100644 playground/src/api/category/controllers/category.ts create mode 100644 playground/src/api/category/routes/category.ts create mode 100644 playground/src/api/category/services/category.ts (limited to 'playground/src/api/category') diff --git a/playground/src/api/category/content-types/category/schema.json b/playground/src/api/category/content-types/category/schema.json new file mode 100644 index 0000000..5121cdd --- /dev/null +++ b/playground/src/api/category/content-types/category/schema.json @@ -0,0 +1,31 @@ +{ + "kind": "collectionType", + "collectionName": "categories", + "info": { + "singularName": "category", + "pluralName": "categories", + "displayName": "Category", + "description": "Organize your content into categories" + }, + "options": { + "draftAndPublish": false + }, + "pluginOptions": {}, + "attributes": { + "name": { + "type": "string" + }, + "slug": { + "type": "uid" + }, + "articles": { + "type": "relation", + "relation": "oneToMany", + "target": "api::article.article", + "mappedBy": "category" + }, + "description": { + "type": "text" + } + } +} diff --git a/playground/src/api/category/controllers/category.ts b/playground/src/api/category/controllers/category.ts new file mode 100644 index 0000000..dbfbd34 --- /dev/null +++ b/playground/src/api/category/controllers/category.ts @@ -0,0 +1,7 @@ +/** + * category controller + */ + +import { factories } from '@strapi/strapi'; + +export default factories.createCoreController('api::category.category'); diff --git a/playground/src/api/category/routes/category.ts b/playground/src/api/category/routes/category.ts new file mode 100644 index 0000000..4cbab60 --- /dev/null +++ b/playground/src/api/category/routes/category.ts @@ -0,0 +1,7 @@ +/** + * category router. + */ + +import { factories } from '@strapi/strapi'; + +export default factories.createCoreRouter('api::category.category'); diff --git a/playground/src/api/category/services/category.ts b/playground/src/api/category/services/category.ts new file mode 100644 index 0000000..c956dda --- /dev/null +++ b/playground/src/api/category/services/category.ts @@ -0,0 +1,7 @@ +/** + * category service. + */ + +import { factories } from '@strapi/strapi'; + +export default factories.createCoreService('api::category.category'); -- cgit v1.2.3