Skip to content

Commit

Permalink
PR #4 Variants Expansion
Browse files Browse the repository at this point in the history
  • Loading branch information
ediazjz authored Aug 28, 2022
2 parents 8af7a2e + 90c9404 commit dfa39a7
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 23 deletions.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
45 changes: 27 additions & 18 deletions src/api/product/content-types/product/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,6 @@
"description": {
"type": "richtext"
},
"media": {
"type": "media",
"multiple": true,
"required": true,
"allowedTypes": [
"images"
],
"pluginOptions": {}
},
"price": {
"type": "float",
"required": true,
Expand All @@ -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",
Expand All @@ -74,13 +90,6 @@
"relation": "manyToMany",
"target": "api::collection.collection",
"mappedBy": "products"
},
"seoInformation": {
"displayName": "SEO",
"type": "component",
"repeatable": false,
"component": "seo.seo",
"required": false
}
}
}
22 changes: 22 additions & 0 deletions src/components/variants/variant-group.json
Original file line number Diff line number Diff line change
@@ -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
}
}
}
47 changes: 47 additions & 0 deletions src/components/variants/variant.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
}
}

0 comments on commit dfa39a7

Please sign in to comment.