Added Category schema.

This commit is contained in:
David Ball 2024-07-23 00:50:58 +00:00
parent 5e367e314d
commit 1f0e3fa351
4 changed files with 90 additions and 0 deletions

View File

@ -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"
}
}
}

View File

@ -0,0 +1,7 @@
/**
* category controller
*/
import { factories } from '@strapi/strapi'
export default factories.createCoreController('api::category.category');

View File

@ -0,0 +1,7 @@
/**
* category router
*/
import { factories } from '@strapi/strapi';
export default factories.createCoreRouter('api::category.category');

View File

@ -0,0 +1,7 @@
/**
* category service
*/
import { factories } from '@strapi/strapi';
export default factories.createCoreService('api::category.category');