diff --git a/src/api/category/content-types/category/schema.json b/src/api/category/content-types/category/schema.json new file mode 100644 index 0000000..637972a --- /dev/null +++ b/src/api/category/content-types/category/schema.json @@ -0,0 +1,69 @@ +{ + "kind": "collectionType", + "collectionName": "categories", + "info": { + "singularName": "category", + "pluralName": "categories", + "displayName": "Category", + "description": "" + }, + "options": { + "draftAndPublish": true + }, + "pluginOptions": { + "i18n": { + "localized": true + } + }, + "attributes": { + "name": { + "pluginOptions": { + "i18n": { + "localized": true + } + }, + "type": "string" + }, + "slug": { + "pluginOptions": { + "i18n": { + "localized": true + } + }, + "type": "string" + }, + "categoryImage": { + "type": "media", + "multiple": false, + "required": false, + "allowedTypes": [ + "images" + ], + "pluginOptions": { + "i18n": { + "localized": true + } + } + }, + "description": { + "pluginOptions": { + "i18n": { + "localized": true + } + }, + "type": "blocks" + }, + "parentCategories": { + "type": "relation", + "relation": "manyToMany", + "target": "api::category.category", + "inversedBy": "childCategories" + }, + "childCategories": { + "type": "relation", + "relation": "manyToMany", + "target": "api::category.category", + "inversedBy": "parentCategories" + } + } +} diff --git a/src/api/category/controllers/category.ts b/src/api/category/controllers/category.ts new file mode 100644 index 0000000..4f9f521 --- /dev/null +++ b/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/src/api/category/routes/category.ts b/src/api/category/routes/category.ts new file mode 100644 index 0000000..29daf72 --- /dev/null +++ b/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/src/api/category/services/category.ts b/src/api/category/services/category.ts new file mode 100644 index 0000000..b4d79e2 --- /dev/null +++ b/src/api/category/services/category.ts @@ -0,0 +1,7 @@ +/** + * category service + */ + +import { factories } from '@strapi/strapi'; + +export default factories.createCoreService('api::category.category');