diff --git a/package.json b/package.json index 5a71cc2..f22a51d 100644 --- a/package.json +++ b/package.json @@ -10,11 +10,11 @@ "strapi": "strapi" }, "dependencies": { - "@strapi/plugin-graphql": "^4.2.0", - "@strapi/plugin-i18n": "4.2.0", - "@strapi/plugin-users-permissions": "4.2.0", - "@strapi/provider-upload-cloudinary": "^4.2.0", - "@strapi/strapi": "4.2.0", + "@strapi/plugin-graphql": "^4.3.6", + "@strapi/plugin-i18n": "4.3.6", + "@strapi/plugin-users-permissions": "4.3.6", + "@strapi/provider-upload-cloudinary": "^4.3.6", + "@strapi/strapi": "4.3.6", "better-sqlite3": "7.4.6", "pg": "^8.7.3", "pg-connection-string": "^2.5.0" diff --git a/src/api/product/content-types/product/schema.json b/src/api/product/content-types/product/schema.json index 7f75739..54a8abe 100644 --- a/src/api/product/content-types/product/schema.json +++ b/src/api/product/content-types/product/schema.json @@ -25,15 +25,6 @@ "description": { "type": "richtext" }, - "media": { - "type": "media", - "multiple": true, - "required": true, - "allowedTypes": [ - "images" - ], - "pluginOptions": {} - }, "price": { "type": "float", "required": true, @@ -49,16 +40,41 @@ "required": true, "min": 0 }, - "inventory": { + "sku": { + "type": "uid", + "required": true + }, + "quantity": { "type": "integer", "required": true, - "min": 1 + "min": 0 }, "sellWithoutStock": { "type": "boolean", "default": false, "required": false }, + "media": { + "type": "media", + "multiple": true, + "required": true, + "allowedTypes": [ + "images" + ], + "pluginOptions": {} + }, + "variants": { + "type": "component", + "repeatable": true, + "component": "variants.variant-group" + }, + "seoInformation": { + "displayName": "SEO", + "type": "component", + "repeatable": false, + "component": "seo.seo", + "required": false + }, "productType": { "type": "relation", "relation": "oneToOne", @@ -74,13 +90,6 @@ "relation": "manyToMany", "target": "api::collection.collection", "mappedBy": "products" - }, - "seoInformation": { - "displayName": "SEO", - "type": "component", - "repeatable": false, - "component": "seo.seo", - "required": false } } } diff --git a/src/components/variants/variant-group.json b/src/components/variants/variant-group.json new file mode 100644 index 0000000..5c1b570 --- /dev/null +++ b/src/components/variants/variant-group.json @@ -0,0 +1,22 @@ +{ + "collectionName": "components_variants_variant_groups", + "info": { + "displayName": "Variant Group", + "icon": "arrows-alt" + }, + "options": {}, + "attributes": { + "name": { + "type": "string", + "required": true + }, + "Option": { + "displayName": "Variant", + "type": "component", + "repeatable": true, + "component": "variants.variant", + "required": true, + "min": 1 + } + } +} diff --git a/src/components/variants/variant.json b/src/components/variants/variant.json new file mode 100644 index 0000000..c14c838 --- /dev/null +++ b/src/components/variants/variant.json @@ -0,0 +1,47 @@ +{ + "collectionName": "components_variants_variants", + "info": { + "displayName": "Variant", + "icon": "cart-arrow-down", + "description": "" + }, + "options": {}, + "attributes": { + "variant": { + "type": "string", + "required": true + }, + "price": { + "type": "float", + "required": true, + "min": 0 + }, + "costPerItem": { + "type": "float", + "required": true, + "min": 0 + }, + "compareAtPrice": { + "type": "float", + "required": false, + "min": 0 + }, + "sku": { + "type": "string", + "required": true + }, + "quantity": { + "type": "integer", + "required": true, + "min": 0 + }, + "media": { + "type": "media", + "multiple": false, + "required": false, + "allowedTypes": [ + "images" + ] + } + } +}