Skip to content

Commit

Permalink
Merge pull request #5164 from reactioncommerce/feat-aldeed-isolate-in…
Browse files Browse the repository at this point in the history
…ventory

Inventory Rewrite - new simple-inventory plugin
  • Loading branch information
kieckhafer authored May 13, 2019
2 parents 86c4f6d + 86b0898 commit 74f8945
Show file tree
Hide file tree
Showing 146 changed files with 3,461 additions and 3,966 deletions.
82 changes: 0 additions & 82 deletions imports/collections/schemas/catalog.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,19 +99,10 @@ export const SocialMetadata = new SimpleSchema({
* @type {SimpleSchema}
* @property {String} _id required
* @property {String} barcode optional
* @property {Boolean} canBackorder required, Indicates when the seller has allowed the sale of product which is not in stock
* @property {Date} createdAt required
* @property {Number} height optional, default value: `0`
* @property {Number} index required
* @property {Boolean} inventoryAvailableToSell required, The quantity of this item currently available to sell. This number does not include reserved inventory (i.e. inventory that has been ordered, but not yet processed by the operator). If this is a variant, this number is created by summing all child option inventory numbers. This is most likely the quantity to display in the storefront UI.
* @property {Boolean} inventoryInStock required, The quantity of this item currently in stock. This number is updated when an order is processed by the operator. This number includes all inventory, including reserved inventory (i.e. inventory that has been ordered, but not yet processed by the operator). If this is a variant, this number is created by summing all child option inventory numbers. This is most likely just used as a reference in the operator UI, and not displayed in the storefront UI.
* @property {Boolean} inventoryManagement required, True if inventory management is enabled for this variant
* @property {Boolean} inventoryPolicy required, True if inventory policy is enabled for this variant
* @property {Boolean} isBackorder required, Indicates when a product is currently backordered
* @property {Boolean} isLowQuantity required, Indicates that the product quantity is too low
* @property {Boolean} isSoldOut required, Indicates when the product quantity is zero
* @property {Number} length optional, default value: `0`
* @property {Number} lowInventoryWarningThreshold optional, default value: `0`
* @property {ImageInfo[]} media optional
* @property {Metafield[]} metafields optional
* @property {Number} minOrderQuantity optional, default value: `1`
Expand All @@ -136,10 +127,6 @@ export const VariantBaseSchema = new SimpleSchema({
label: "Barcode",
optional: true
},
"canBackorder": {
type: Boolean,
label: "Can backorder"
},
"createdAt": {
type: Date,
label: "Date/time this variant was created at"
Expand All @@ -155,49 +142,13 @@ export const VariantBaseSchema = new SimpleSchema({
type: SimpleSchema.Integer,
label: "The position of this variant among other variants at the same level of the product-variant-option hierarchy"
},
"inventoryAvailableToSell": {
type: SimpleSchema.Integer,
label: "Inventory available to sell"
},
"inventoryInStock": {
type: SimpleSchema.Integer,
label: "Inventory in stock"
},
"inventoryManagement": {
type: Boolean,
label: "Inventory management"
},
"inventoryPolicy": {
type: Boolean,
label: "Inventory policy"
},
"isBackorder": {
type: Boolean,
label: "Is backordered",
defaultValue: false
},
"isLowQuantity": {
type: Boolean,
label: "Is low quantity"
},
"isSoldOut": {
type: Boolean,
label: "Is sold out"
},
"length": {
type: Number,
label: "Length",
min: 0,
optional: true,
defaultValue: 0
},
"lowInventoryWarningThreshold": {
type: SimpleSchema.Integer,
label: "Warn at",
min: 0,
optional: true,
defaultValue: 0
},
"media": {
type: Array,
label: "Media",
Expand Down Expand Up @@ -301,14 +252,8 @@ export const CatalogVariantSchema = VariantBaseSchema.clone().extend({
* @property {Date} createdAt required
* @property {String} description optional
* @property {Number} height optional, default value: `0`
* @property {Boolean} inventoryAvailableToSell required, The quantity of this item currently available to sell. This number does not include reserved inventory (i.e. inventory that has been ordered, but not yet processed by the operator). If this is a variant, this number is created by summing all child option inventory numbers. This is most likely the quantity to display in the storefront UI.
* @property {Boolean} inventoryInStock required, The quantity of this item currently in stock. This number is updated when an order is processed by the operator. This number includes all inventory, including reserved inventory (i.e. inventory that has been ordered, but not yet processed by the operator). If this is a variant, this number is created by summing all child option inventory numbers. This is most likely just used as a reference in the operator UI, and not displayed in the storefront UI.
* @property {Boolean} isBackorder required, Indicates when a product is currently backordered
* @property {Boolean} isLowQuantity required, Indicates that the product quantity is too low
* @property {Boolean} isSoldOut required, Indicates when the product quantity is zero
* @property {Boolean} isVisible required, default value: `false`
* @property {Number} length optional, default value: `0`
* @property {Number} lowInventoryWarningThreshold optional, default value: `0`
* @property {ImageInfo[]} media optional
* @property {Metafield[]} metafields optional
* @property {String} metaDescription optional
Expand Down Expand Up @@ -359,31 +304,11 @@ export const CatalogProduct = new SimpleSchema({
optional: true,
defaultValue: 0
},
"inventoryAvailableToSell": {
type: SimpleSchema.Integer,
label: "Inventory available to sell"
},
"inventoryInStock": {
type: SimpleSchema.Integer,
label: "Inventory in stock"
},
"isBackorder": {
type: Boolean,
label: "Is backorder"
},
"isDeleted": {
type: Boolean,
label: "Is deleted",
defaultValue: false
},
"isLowQuantity": {
type: Boolean,
label: "Is low quantity"
},
"isSoldOut": {
type: Boolean,
label: "Is sold out"
},
"isVisible": {
type: Boolean,
label: "Indicates if a product is visible to non-admin users",
Expand All @@ -396,13 +321,6 @@ export const CatalogProduct = new SimpleSchema({
optional: true,
defaultValue: 0
},
"lowInventoryWarningThreshold": {
type: SimpleSchema.Integer,
label: "Warn at",
min: 0,
optional: true,
defaultValue: 0
},
"media": {
type: Array,
label: "Media",
Expand Down
1 change: 0 additions & 1 deletion imports/collections/schemas/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export * from "./catalog";
export * from "./cart";
export * from "./core";
export * from "./emails";
export * from "./inventory";
export * from "./layouts";
export * from "./metafield";
export * from "./navigationItems";
Expand Down
83 changes: 0 additions & 83 deletions imports/collections/schemas/inventory.js

This file was deleted.

119 changes: 0 additions & 119 deletions imports/collections/schemas/products.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,9 @@ registerSchema("VariantMedia", VariantMedia);
* @property {Event[]} eventLog optional, Variant Event Log
* @property {Number} height optional, default value: `0`
* @property {Number} index optional, Variant position number in list. Keep array index for moving variants in a list.
* @property {Boolean} inventoryAvailableToSell required
* @property {Boolean} inventoryInStock required
* @property {Boolean} inventoryManagement, default value: `true`
* @property {Boolean} inventoryPolicy, default value: `false`, If disabled, item can be sold even if it not in stock.
* @property {Number} inventoryInStock, default value: `0`
* @property {Boolean} isBackorder denormalized, `true` if product not in stock, but customers anyway could order it
* @property {Boolean} isDeleted, default value: `false`
* @property {Boolean} isLowQuantity optional, true when at least 1 variant is below `lowInventoryWarningThreshold`
* @property {Boolean} isSoldOut optional, denormalized field, indicates when all variants `inventoryInStock` is 0
* @property {Boolean} isVisible, default value: `false`
* @property {Number} length optional, default value: `0`
* @property {Number} lowInventoryWarningThreshold, default value: `0`, Warn of low inventory at this number
* @property {Metafield[]} metafields optional
* @property {Number} minOrderQuantity optional
* @property {String} optionTitle, Option internal name, default value: `"Untitled option"`
Expand Down Expand Up @@ -134,73 +125,10 @@ export const ProductVariant = new SimpleSchema({
type: SimpleSchema.Integer,
optional: true
},
"inventoryManagement": {
type: Boolean,
label: "Inventory Tracking",
optional: true,
defaultValue: true,
custom() {
if (Meteor.isClient) {
if (!(this.siblingField("type").value === "inventory" || this.value ||
this.value === false)) {
return SimpleSchema.ErrorTypes.REQUIRED;
}
}
}
},
"inventoryPolicy": {
type: Boolean,
label: "Deny when out of stock",
optional: true,
defaultValue: false,
custom() {
if (Meteor.isClient) {
if (!(this.siblingField("type").value === "inventory" || this.value ||
this.value === false)) {
return SimpleSchema.ErrorTypes.REQUIRED;
}
}
}
},
"inventoryAvailableToSell": {
type: SimpleSchema.Integer,
label: "The quantity of this item currently available to sell." +
"This number is updated when an order is placed by the customer." +
"This number does not include reserved inventory (i.e. inventory that has been ordered, but not yet processed by the operator)." +
"If this is a variant, this number is created by summing all child option inventory numbers." +
"This is most likely the quantity to display in the storefront UI.",
optional: true,
defaultValue: 0
},
"inventoryInStock": {
type: SimpleSchema.Integer,
label: "The quantity of this item currently in stock." +
"This number is updated when an order is processed by the operator." +
"This number includes all inventory, including reserved inventory (i.e. inventory that has been ordered, but not yet processed by the operator)." +
"If this is a variant, this number is created by summing all child option inventory numbers." +
"This is most likely just used as a reference in the operator UI, and not displayed in the storefront UI.",
optional: true,
defaultValue: 0
},
"isBackorder": {
label: "Indicates when a product is currently backordered",
type: Boolean,
optional: true
},
"isDeleted": {
type: Boolean,
defaultValue: false
},
"isLowQuantity": {
label: "Indicates that the product quantity is too low",
type: Boolean,
optional: true
},
"isSoldOut": {
label: "Indicates when the product quantity is zero",
type: Boolean,
optional: true
},
"isVisible": {
type: Boolean,
defaultValue: false
Expand All @@ -212,13 +140,6 @@ export const ProductVariant = new SimpleSchema({
optional: true,
defaultValue: 0
},
"lowInventoryWarningThreshold": {
type: SimpleSchema.Integer,
label: "Warn at",
min: 0,
optional: true,
defaultValue: 0
},
"metafields": {
type: Array,
optional: true
Expand Down Expand Up @@ -309,12 +230,7 @@ registerSchema("ProductVariant", ProductVariant);
* @property {String} googleplusMsg optional
* @property {String} handle optional, slug
* @property {String[]} hashtags optional
* @property {Boolean} inventoryAvailableToSell required
* @property {Boolean} inventoryInStock required
* @property {Boolean} isBackorder denormalized, `true` if product not in stock, but customers anyway could order it
* @property {Boolean} isDeleted, default value: `false`
* @property {Boolean} isLowQuantity denormalized, true when at least 1 variant is below `lowInventoryWarningThreshold`
* @property {Boolean} isSoldOut denormalized, Indicates when all variants `inventoryInStock` is zero
* @property {Boolean} isVisible, default value: `false`
* @property {String} metaDescription optional
* @property {Metafield[]} metafields optional
Expand Down Expand Up @@ -381,45 +297,10 @@ export const Product = new SimpleSchema({
"hashtags.$": {
type: String
},
"inventoryAvailableToSell": {
type: SimpleSchema.Integer,
label: "The quantity of this item currently available to sell." +
"This number is updated when an order is placed by the customer." +
"This number does not include reserved inventory (i.e. inventory that has been ordered, but not yet processed by the operator)." +
"If this is a variant, this number is created by summing all child option inventory numbers." +
"This is most likely the quantity to display in the storefront UI.",
optional: true,
defaultValue: 0
},
"inventoryInStock": {
type: SimpleSchema.Integer,
label: "The quantity of this item currently in stock." +
"This number is updated when an order is processed by the operator." +
"This number includes all inventory, including reserved inventory (i.e. inventory that has been ordered, but not yet processed by the operator)." +
"If this is a variant, this number is created by summing all child option inventory numbers." +
"This is most likely just used as a reference in the operator UI, and not displayed in the storefront UI.",
optional: true,
defaultValue: 0
},
"isBackorder": {
label: "Indicates when a product is currently backordered",
type: Boolean,
optional: true
},
"isDeleted": {
type: Boolean,
defaultValue: false
},
"isLowQuantity": {
label: "Indicates that the product quantity is too low",
type: Boolean,
optional: true
},
"isSoldOut": {
label: "Indicates when the product quantity is zero",
type: Boolean,
optional: true
},
"isVisible": {
type: Boolean,
defaultValue: false
Expand Down
Loading

0 comments on commit 74f8945

Please sign in to comment.