Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inventory Rewrite - new simple-inventory plugin #5164

Merged
merged 58 commits into from
May 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
81acae2
feat: remove unused Inventory collection
aldeed Apr 30, 2019
22805b6
refactor: remove setting inventory on Product
aldeed Apr 30, 2019
49e24ca
refactor: move inventory field catalog publish
aldeed Apr 30, 2019
ed20a40
fix: remove moment use to address errors
aldeed May 1, 2019
bdae5b5
refactor: move Catalog inventory fields
aldeed May 1, 2019
de84b56
test: update test mocks
aldeed May 1, 2019
2cc6c61
refactor: updates to inventory client UI code
aldeed May 1, 2019
7a56c89
feat: remove inventory fields from Product
aldeed May 1, 2019
a433008
feat: split inventory plugin to simple-inventory
aldeed May 1, 2019
2fe5bfb
feat: remove inventory auto-publish
aldeed May 1, 2019
c159cea
refactor: delegate inventoryForProductConfigurations to simple-invent…
aldeed May 1, 2019
dd79d7b
Merge branch 'develop' into feat-aldeed-isolate-inventory
aldeed May 1, 2019
b048788
fix: adjust inventory field calcs
aldeed May 1, 2019
c5f0226
refactor: no-meteor simple-inventory register
aldeed May 1, 2019
2f6c62d
refactor: move inventory GraphQL defs
aldeed May 1, 2019
853f744
feat: add xformCatalogProductVariants
aldeed May 1, 2019
0a07283
refactor: more work on inventoryForProductConfigurations
aldeed May 1, 2019
9f10728
docs: improve inventory gql schema docs
aldeed May 2, 2019
75827c0
refactor: inventory field cleanup
aldeed May 2, 2019
a3d1b89
feat: use inventoryForProductConfiguration for check
aldeed May 2, 2019
52e6a0e
refactor: more inventory refactoring
aldeed May 2, 2019
8887a72
feat: client side simple-inventory
aldeed May 3, 2019
15b178c
feat: migrate inventory data to SimpleInventory
aldeed May 3, 2019
4bc11b7
fix: various fixes to simple-inventory
aldeed May 3, 2019
3f9b778
feat: allow internal calls to updateSimpleInventory
aldeed May 3, 2019
47cbcae
refactor: deMeteorize core inventory register
aldeed May 3, 2019
267f02a
test: fix test mock data
aldeed May 3, 2019
2f3052f
test: fix inventory-related integration tests
aldeed May 3, 2019
89473f8
fix: update hashProduct func used for migrations
aldeed May 8, 2019
317e501
fix: update catalog inventory bools
aldeed May 8, 2019
5925800
feat: show reserved/available inventory on form
aldeed May 8, 2019
68b6954
feat: add admin button to recalc reserved inventory
aldeed May 8, 2019
aba4b89
feat: skip product check for internal inventory update calls
aldeed May 8, 2019
f0e76a4
fix: fix simple inventory recalc error
aldeed May 9, 2019
d7ec157
Merge branch 'develop' into feat-aldeed-isolate-inventory
aldeed May 9, 2019
398ac18
fix: set inventoryReserved correctly on SimpleInventory insert
aldeed May 9, 2019
0e33e97
refactor: improve perf of setting initial inventoryReserved
aldeed May 9, 2019
6708089
perf: optimization for updateSimpleInventory mutation
aldeed May 9, 2019
cca97aa
feat: add isInternalCall check to simpleInventory query
aldeed May 9, 2019
c395fba
fix: proper array filtering for migration 63
aldeed May 10, 2019
2e7221f
fix: default value for options
aldeed May 10, 2019
fa14473
fix: use string _id for SimpleInventory
aldeed May 10, 2019
5806137
fix: use string _id for SimpleInventory
aldeed May 10, 2019
3206d49
Merge branch 'feat-aldeed-isolate-inventory' of github.com:reactionco…
aldeed May 10, 2019
c292d89
docs: documentation improvements
aldeed May 10, 2019
8908a2f
refactor: move migration util to no-meteor
aldeed May 10, 2019
d851498
refactor: speed up migration 63
aldeed May 10, 2019
7790b1b
refactor: ensure migration 63 update can use index
aldeed May 10, 2019
1189fb5
add `readyForMigrations` appEvent
kieckhafer May 10, 2019
065fa2e
fix: fix inventory xform
aldeed May 10, 2019
8d25770
refactor: minor adjustments to simple-inventory startup
aldeed May 10, 2019
f5b05c5
test: add testApp.publishProducts func
aldeed May 10, 2019
476c904
test: inventory integration tests
aldeed May 10, 2019
28c64bc
move/remove Importer actions
kieckhafer May 10, 2019
22115ba
lint fix
kieckhafer May 10, 2019
205b07f
fix: fix error logging of index drop migrations
aldeed May 10, 2019
eaa05df
fix: startup fixes
aldeed May 13, 2019
86b0898
fix: disable migration 3
aldeed May 13, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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