Added Product schema.
This commit is contained in:
parent
1f0e3fa351
commit
2a2fdaf7ef
|
|
@ -58,6 +58,12 @@
|
|||
"localized": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"products": {
|
||||
"type": "relation",
|
||||
"relation": "oneToMany",
|
||||
"target": "api::product.product",
|
||||
"mappedBy": "brand"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,6 +64,12 @@
|
|||
"relation": "manyToMany",
|
||||
"target": "api::category.category",
|
||||
"inversedBy": "parentCategories"
|
||||
},
|
||||
"products": {
|
||||
"type": "relation",
|
||||
"relation": "manyToMany",
|
||||
"target": "api::product.product",
|
||||
"mappedBy": "categories"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
71
src/api/product/content-types/product/schema.json
Normal file
71
src/api/product/content-types/product/schema.json
Normal 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"
|
||||
}
|
||||
}
|
||||
}
|
||||
7
src/api/product/controllers/product.ts
Normal file
7
src/api/product/controllers/product.ts
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
/**
|
||||
* product controller
|
||||
*/
|
||||
|
||||
import { factories } from '@strapi/strapi'
|
||||
|
||||
export default factories.createCoreController('api::product.product');
|
||||
7
src/api/product/routes/product.ts
Normal file
7
src/api/product/routes/product.ts
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
/**
|
||||
* product router
|
||||
*/
|
||||
|
||||
import { factories } from '@strapi/strapi';
|
||||
|
||||
export default factories.createCoreRouter('api::product.product');
|
||||
7
src/api/product/services/product.ts
Normal file
7
src/api/product/services/product.ts
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
/**
|
||||
* product service
|
||||
*/
|
||||
|
||||
import { factories } from '@strapi/strapi';
|
||||
|
||||
export default factories.createCoreService('api::product.product');
|
||||
Loading…
Reference in New Issue
Block a user