diff --git a/src/api/collection/content-types/collection/schema.json b/src/api/collection/content-types/collection/schema.json new file mode 100644 index 0000000..effb53b --- /dev/null +++ b/src/api/collection/content-types/collection/schema.json @@ -0,0 +1,42 @@ +{ + "kind": "collectionType", + "collectionName": "collections", + "info": { + "singularName": "collection", + "pluralName": "collections", + "displayName": "Collection", + "description": "" + }, + "options": { + "draftAndPublish": true + }, + "pluginOptions": {}, + "attributes": { + "title": { + "type": "string", + "required": true + }, + "slug": { + "type": "uid", + "targetField": "title", + "required": true + }, + "description": { + "type": "richtext" + }, + "image": { + "type": "media", + "multiple": false, + "required": false, + "allowedTypes": [ + "images" + ] + }, + "products": { + "type": "relation", + "relation": "manyToMany", + "target": "api::product.product", + "inversedBy": "collections" + } + } +} diff --git a/src/api/collection/controllers/collection.js b/src/api/collection/controllers/collection.js new file mode 100644 index 0000000..851508c --- /dev/null +++ b/src/api/collection/controllers/collection.js @@ -0,0 +1,9 @@ +'use strict'; + +/** + * collection controller + */ + +const { createCoreController } = require('@strapi/strapi').factories; + +module.exports = createCoreController('api::collection.collection'); diff --git a/src/api/collection/routes/collection.js b/src/api/collection/routes/collection.js new file mode 100644 index 0000000..c436ff3 --- /dev/null +++ b/src/api/collection/routes/collection.js @@ -0,0 +1,9 @@ +'use strict'; + +/** + * collection router. + */ + +const { createCoreRouter } = require('@strapi/strapi').factories; + +module.exports = createCoreRouter('api::collection.collection'); diff --git a/src/api/collection/services/collection.js b/src/api/collection/services/collection.js new file mode 100644 index 0000000..7c3fa39 --- /dev/null +++ b/src/api/collection/services/collection.js @@ -0,0 +1,9 @@ +'use strict'; + +/** + * collection service. + */ + +const { createCoreService } = require('@strapi/strapi').factories; + +module.exports = createCoreService('api::collection.collection'); diff --git a/src/api/product-type/content-types/product-type/schema.json b/src/api/product-type/content-types/product-type/schema.json new file mode 100644 index 0000000..97b2016 --- /dev/null +++ b/src/api/product-type/content-types/product-type/schema.json @@ -0,0 +1,26 @@ +{ + "kind": "collectionType", + "collectionName": "product_types", + "info": { + "singularName": "product-type", + "pluralName": "product-types", + "displayName": "Product Type", + "description": "" + }, + "options": { + "draftAndPublish": false + }, + "pluginOptions": {}, + "attributes": { + "name": { + "type": "string", + "required": true, + "unique": false + }, + "slug": { + "type": "uid", + "targetField": "name", + "required": true + } + } +} diff --git a/src/api/product-type/controllers/product-type.js b/src/api/product-type/controllers/product-type.js new file mode 100644 index 0000000..0c96bbc --- /dev/null +++ b/src/api/product-type/controllers/product-type.js @@ -0,0 +1,9 @@ +'use strict'; + +/** + * product-type controller + */ + +const { createCoreController } = require('@strapi/strapi').factories; + +module.exports = createCoreController('api::product-type.product-type'); diff --git a/src/api/product-type/routes/product-type.js b/src/api/product-type/routes/product-type.js new file mode 100644 index 0000000..cdc445a --- /dev/null +++ b/src/api/product-type/routes/product-type.js @@ -0,0 +1,9 @@ +'use strict'; + +/** + * product-type router. + */ + +const { createCoreRouter } = require('@strapi/strapi').factories; + +module.exports = createCoreRouter('api::product-type.product-type'); diff --git a/src/api/product-type/services/product-type.js b/src/api/product-type/services/product-type.js new file mode 100644 index 0000000..a2f2004 --- /dev/null +++ b/src/api/product-type/services/product-type.js @@ -0,0 +1,9 @@ +'use strict'; + +/** + * product-type service. + */ + +const { createCoreService } = require('@strapi/strapi').factories; + +module.exports = createCoreService('api::product-type.product-type'); diff --git a/src/api/product/content-types/product/schema.json b/src/api/product/content-types/product/schema.json index 8a0bf16..c4eda72 100644 --- a/src/api/product/content-types/product/schema.json +++ b/src/api/product/content-types/product/schema.json @@ -8,64 +8,72 @@ "description": "" }, "options": { - "draftAndPublish": false - }, - "pluginOptions": { - "i18n": { - "localized": true - } + "draftAndPublish": true }, + "pluginOptions": {}, "attributes": { "title": { - "pluginOptions": { - "i18n": { - "localized": true - } - }, "type": "string", "required": true, - "unique": true + "unique": false }, - "description": { - "pluginOptions": { - "i18n": { - "localized": true - } - }, - "type": "text", + "slug": { + "type": "uid", + "targetField": "title", "required": true }, - "image": { + "description": { + "type": "richtext" + }, + "media": { "type": "media", - "multiple": false, + "multiple": true, "required": true, "allowedTypes": [ "images" ], - "pluginOptions": { - "i18n": { - "localized": true - } - } - }, - "slug": { - "pluginOptions": { - "i18n": { - "localized": true - } - }, - "type": "uid", - "targetField": "title", - "required": true + "pluginOptions": {} }, "price": { - "pluginOptions": { - "i18n": { - "localized": false - } - }, "type": "float", - "required": true + "required": true, + "unique": false, + "min": 0 + }, + "compareAtPrice": { + "type": "float", + "min": 0 + }, + "costPerItem": { + "type": "float", + "required": true, + "min": 0 + }, + "inventory": { + "type": "integer", + "required": true, + "min": 1 + }, + "sellWithoutStock": { + "type": "boolean", + "default": false, + "required": false + }, + "productType": { + "type": "relation", + "relation": "oneToOne", + "target": "api::product-type.product-type" + }, + "tags": { + "type": "relation", + "relation": "oneToMany", + "target": "api::tag.tag" + }, + "collections": { + "type": "relation", + "relation": "manyToMany", + "target": "api::collection.collection", + "mappedBy": "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..0bade31 --- /dev/null +++ b/src/api/tag/content-types/tag/schema.json @@ -0,0 +1,25 @@ +{ + "kind": "collectionType", + "collectionName": "tags", + "info": { + "singularName": "tag", + "pluralName": "tags", + "displayName": "Tag", + "description": "" + }, + "options": { + "draftAndPublish": false + }, + "pluginOptions": {}, + "attributes": { + "name": { + "type": "string", + "required": true + }, + "slug": { + "type": "uid", + "targetField": "name", + "required": true + } + } +} diff --git a/src/api/tag/controllers/tag.js b/src/api/tag/controllers/tag.js new file mode 100644 index 0000000..e3ad217 --- /dev/null +++ b/src/api/tag/controllers/tag.js @@ -0,0 +1,9 @@ +'use strict'; + +/** + * tag controller + */ + +const { createCoreController } = require('@strapi/strapi').factories; + +module.exports = createCoreController('api::tag.tag'); diff --git a/src/api/tag/routes/tag.js b/src/api/tag/routes/tag.js new file mode 100644 index 0000000..da94f3c --- /dev/null +++ b/src/api/tag/routes/tag.js @@ -0,0 +1,9 @@ +'use strict'; + +/** + * tag router. + */ + +const { createCoreRouter } = require('@strapi/strapi').factories; + +module.exports = createCoreRouter('api::tag.tag'); diff --git a/src/api/tag/services/tag.js b/src/api/tag/services/tag.js new file mode 100644 index 0000000..60712e3 --- /dev/null +++ b/src/api/tag/services/tag.js @@ -0,0 +1,9 @@ +'use strict'; + +/** + * tag service. + */ + +const { createCoreService } = require('@strapi/strapi').factories; + +module.exports = createCoreService('api::tag.tag');