diff --git a/src/api/product/content-types/product/schema.json b/src/api/product/content-types/product/schema.json index 48ed38f..e6dff91 100644 --- a/src/api/product/content-types/product/schema.json +++ b/src/api/product/content-types/product/schema.json @@ -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" } } } diff --git a/src/api/tag/content-types/tag/schema.json b/src/api/tag/content-types/tag/schema.json new file mode 100644 index 0000000..409db49 --- /dev/null +++ b/src/api/tag/content-types/tag/schema.json @@ -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" + } + } +} diff --git a/src/api/tag/controllers/tag.ts b/src/api/tag/controllers/tag.ts new file mode 100644 index 0000000..0b3e997 --- /dev/null +++ b/src/api/tag/controllers/tag.ts @@ -0,0 +1,7 @@ +/** + * tag controller + */ + +import { factories } from '@strapi/strapi' + +export default factories.createCoreController('api::tag.tag'); diff --git a/src/api/tag/routes/tag.ts b/src/api/tag/routes/tag.ts new file mode 100644 index 0000000..d15b0cf --- /dev/null +++ b/src/api/tag/routes/tag.ts @@ -0,0 +1,7 @@ +/** + * tag router + */ + +import { factories } from '@strapi/strapi'; + +export default factories.createCoreRouter('api::tag.tag'); diff --git a/src/api/tag/services/tag.ts b/src/api/tag/services/tag.ts new file mode 100644 index 0000000..d45b676 --- /dev/null +++ b/src/api/tag/services/tag.ts @@ -0,0 +1,7 @@ +/** + * tag service + */ + +import { factories } from '@strapi/strapi'; + +export default factories.createCoreService('api::tag.tag');