Added Tag schema.

This commit is contained in:
David Ball 2024-07-23 00:57:13 +00:00
parent 2a2fdaf7ef
commit 644d9743a9
5 changed files with 63 additions and 1 deletions

View File

@ -4,7 +4,8 @@
"info": {
"singularName": "product",
"pluralName": "products",
"displayName": "Product"
"displayName": "Product",
"description": ""
},
"options": {
"draftAndPublish": true
@ -66,6 +67,12 @@
"relation": "manyToMany",
"target": "api::category.category",
"inversedBy": "products"
},
"tags": {
"type": "relation",
"relation": "manyToMany",
"target": "api::tag.tag",
"inversedBy": "products"
}
}
}

View File

@ -0,0 +1,34 @@
{
"kind": "collectionType",
"collectionName": "tags",
"info": {
"singularName": "tag",
"pluralName": "tags",
"displayName": "Tag",
"description": ""
},
"options": {
"draftAndPublish": true
},
"pluginOptions": {
"i18n": {
"localized": true
}
},
"attributes": {
"slug": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "string"
},
"products": {
"type": "relation",
"relation": "manyToMany",
"target": "api::product.product",
"mappedBy": "tags"
}
}
}

View File

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

View File

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

View File

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