Added Product schema.

This commit is contained in:
David Ball 2024-07-23 00:55:14 +00:00
parent 1f0e3fa351
commit 2a2fdaf7ef
6 changed files with 104 additions and 0 deletions

View File

@ -58,6 +58,12 @@
"localized": true "localized": true
} }
} }
},
"products": {
"type": "relation",
"relation": "oneToMany",
"target": "api::product.product",
"mappedBy": "brand"
} }
} }
} }

View File

@ -64,6 +64,12 @@
"relation": "manyToMany", "relation": "manyToMany",
"target": "api::category.category", "target": "api::category.category",
"inversedBy": "parentCategories" "inversedBy": "parentCategories"
},
"products": {
"type": "relation",
"relation": "manyToMany",
"target": "api::product.product",
"mappedBy": "categories"
} }
} }
} }

View File

@ -0,0 +1,71 @@
{
"kind": "collectionType",
"collectionName": "products",
"info": {
"singularName": "product",
"pluralName": "products",
"displayName": "Product"
},
"options": {
"draftAndPublish": true
},
"pluginOptions": {
"i18n": {
"localized": true
}
},
"attributes": {
"name": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "string"
},
"title": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "string"
},
"slug": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "string"
},
"brand": {
"type": "relation",
"relation": "manyToOne",
"target": "api::brand.brand",
"inversedBy": "products"
},
"callout": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "blocks"
},
"description": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "blocks"
},
"categories": {
"type": "relation",
"relation": "manyToMany",
"target": "api::category.category",
"inversedBy": "products"
}
}
}

View File

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

View File

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

View File

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