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

Catalog schema changes #4218

Merged
merged 150 commits into from May 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
150 commits
Select commit Hold shift + click to select a range
aa61d1c
chore(GraphQL): fix alpha sort
aldeed Apr 23, 2018
f6999cb
chore: remove unused helper function
aldeed Apr 23, 2018
ed3218d
refactor: Initial work to adjust Catalog collection schema
aldeed Apr 23, 2018
6dd895a
refactor: started moving the ProductRevision object out of the server…
nnnnat Apr 24, 2018
e7481d6
refactor: started moving catalog server methods into their own files …
nnnnat Apr 24, 2018
5b075f5
Merge branch 'release-1.12.0' into refactor-4196-aldeed-catalog-schem…
nnnnat Apr 24, 2018
a1cd9c8
refactor: fixed some linting issues
nnnnat Apr 24, 2018
47798f4
refactor: created two test for the isSoldOut function, updated isSold…
nnnnat Apr 24, 2018
9e5d5dd
refactor: added a few more test cases to isSoldOut.test.js
nnnnat Apr 24, 2018
fa9efa2
chore: cleaned up isSoldOut.test.js
nnnnat Apr 24, 2018
a3b456d
doc: updated jsdoc added another test for isSoldOut func
nnnnat Apr 24, 2018
31c7f80
refactor: moved isLowQuantity funciton out into it's own file, added …
nnnnat Apr 24, 2018
7c68c12
chore: cleanup isLowQuantity catalog func jsdoc
nnnnat Apr 24, 2018
599bbe6
refactor: moved isBackorder function to it's own file, create test
nnnnat Apr 24, 2018
b36398e
chore: fixed typos and comments
nnnnat Apr 24, 2018
427101c
chore: ran eslint --fix
nnnnat Apr 24, 2018
dfa5dda
refactor: moved getCatalogPositions function to it's own file, create…
nnnnat Apr 25, 2018
9c4b154
test: added another test for the CatalogPositions func
nnnnat Apr 25, 2018
6547dfe
docs: updated jsdocs for the new catalog functions
nnnnat Apr 25, 2018
30aa2c4
refator: publishProductToCatalog function moved into it's own file, s…
nnnnat Apr 25, 2018
53d9254
chore: rebuilt the docker container
nnnnat Apr 25, 2018
7334145
refactor: moved publishProductIdToCatalog to it's own file, created a…
nnnnat Apr 25, 2018
f2229ca
feat: added a few mock collections and methods to the mockContext tes…
nnnnat Apr 25, 2018
72a9913
refactor: cleaning up the publishProductToCatalog function, fleshed o…
nnnnat Apr 25, 2018
850b17a
refactor: renamed publishProductIdToCatalog to publishProductToCatalo…
nnnnat Apr 25, 2018
06e0434
chore: renamed publishProductToCatalogById some code cleanup
nnnnat Apr 25, 2018
4c56083
refacotr: publishProductToCatalogById function clean up added await t…
nnnnat Apr 25, 2018
ee42dc5
refactor: breaking publishProductsToCatalog into it's own file and test
nnnnat Apr 26, 2018
9147599
docs: updated jsdoc to have collections param
nnnnat Apr 26, 2018
36e6835
refactor: updated publishProductsToCatalog func and created a few tes…
nnnnat Apr 26, 2018
631e7da
docs: added collections param to jsdocs
nnnnat Apr 26, 2018
6ab8b5f
refactor: updated publishProductInventoryAdjustment function, wrote a…
nnnnat Apr 26, 2018
d5b345e
Merge branch 'release-1.12.0' into refactor-4196-aldeed-catalog-schem…
nnnnat Apr 26, 2018
e24b106
refactor: moved productMedia array creation into it's own file and cr…
nnnnat Apr 26, 2018
35887b3
refactor: import the new getCatalogProductMedia function started repl…
nnnnat Apr 26, 2018
22e5935
feat: created a mutions file for graphql, imported the publishProduct…
nnnnat Apr 26, 2018
04fba35
feat: created publishProductsToCatalog gql mutation
nnnnat Apr 26, 2018
540ce1e
feat: created new function that builds a context object to be used wi…
nnnnat Apr 26, 2018
70dcc3f
feat: created mutation function for publishingProducts into the catal…
nnnnat Apr 26, 2018
39890c2
feat: updated devserver to import and include the new mutations
nnnnat Apr 26, 2018
ab62e9c
feat: updated the mockContext test util to have most of the collectio…
nnnnat Apr 26, 2018
9a96904
refactor: updated getVariantQuantity to use a provided variants array…
nnnnat Apr 26, 2018
de01507
feat: defined the catalog mutation type and and added a mutation def
nnnnat Apr 26, 2018
9e6713b
feat: importing the new baseContext to the gql server
nnnnat Apr 26, 2018
7e4ab93
refactor: major refactor of catalog.js, clean up and updating params …
nnnnat Apr 26, 2018
cfeaa73
refactor: created new collections dir with a rawCollections.js that p…
nnnnat Apr 27, 2018
7d8745d
refactor: broke ProductRevision object out into several functions fil…
nnnnat Apr 27, 2018
f09eb41
refactor: updated mock context to have the correct mongo collection m…
nnnnat Apr 27, 2018
b89a253
refactor: created test for getCatalogProductMedia function, updated p…
nnnnat Apr 27, 2018
01dd8cf
refactor: updated catalog helper functions to use the refactored revi…
nnnnat Apr 27, 2018
d2ee45d
docs: updated jsdocs return for publishProduct mutation
nnnnat Apr 27, 2018
e7200ee
test: fixed isBackOrder.test by updating the mock to not mock the old…
nnnnat Apr 27, 2018
adc749a
test: corrected function imports and expectation in several catalog f…
nnnnat Apr 27, 2018
ac34eee
refactor: moved all Catalog util functions out of the methods folder …
nnnnat Apr 27, 2018
48eeb1a
refactor: moved catalog server methods into the catalog plugin, renam…
nnnnat Apr 27, 2018
cf7ebe7
chore: fixed merge conflicts with release 1.12
nnnnat Apr 30, 2018
d28ccab
test: created basic test for publishProducts catalog mutation function
nnnnat Apr 30, 2018
c338daf
test: created basic test for findRevision util function
nnnnat Apr 30, 2018
67e5291
fix: support for null token in built-in /graphiql UI
aldeed Apr 30, 2018
b1fd26f
refactor: improve code for grid Catalog query
aldeed Apr 30, 2018
a971dad
test: created test for getProduct revsions util function
nnnnat Apr 30, 2018
529b8d3
Merge branch 'refactor-4196-aldeed-catalog-schema-changes' of github.…
nnnnat Apr 30, 2018
65d75fb
test: creating a test for getProductPriceRange revisions function, no…
nnnnat Apr 30, 2018
cdf917d
test: completed basic te4st for getProductPriceRange revision util fu…
nnnnat Apr 30, 2018
2162796
test: created basic test for getTopVariant
nnnnat Apr 30, 2018
e12c36f
test: created basic test for getVariantPriceRange revision utils func…
nnnnat May 1, 2018
fef4710
test: created basic test for getVariantQuantity revisions util functi…
nnnnat May 1, 2018
09d501c
test: cleaning up unused variables
nnnnat May 1, 2018
d2eb3e6
fix: import typos
aldeed May 1, 2018
6fdec1a
refactor: reuse publishProductToCatalogById and update existing migra…
aldeed May 1, 2018
a9cad54
fix: return default tag ID for non-tag routes
aldeed May 1, 2018
4f68932
test: created basic test for revision util funciton getVariants
nnnnat May 2, 2018
bd17671
Merge branch 'refactor-4196-aldeed-catalog-schema-changes' of github.…
nnnnat May 2, 2018
ad765e4
test: updated catalog util function test to rewire the correct impoor…
nnnnat May 2, 2018
be646ab
refactor: updated getVariants to handle returning only top level and …
nnnnat May 2, 2018
a046947
refactor: created a new general function that builds out the price ob…
nnnnat May 2, 2018
2af991d
refactor: removed findRevision util function, updatedd usage and test
nnnnat May 2, 2018
868a2f6
test: updated getVariants test to check for top variants and variant …
nnnnat May 2, 2018
090cd22
Merge branch 'release-1.12.0' into refactor-4196-aldeed-catalog-schem…
nnnnat May 2, 2018
afd4afb
chore: moved catalog non metoer code into the no-meteor dir
nnnnat May 2, 2018
c6e7e72
chore: moved revision utils into no-meteor/utils dir
nnnnat May 2, 2018
b02aa91
chore: fixed imports of moved non-meteor functions
nnnnat May 2, 2018
3db3e04
test: fixed bad imports in a few unit test files
nnnnat May 3, 2018
0f74bf3
test: updated imports and usage of the updated catalog util fuctions …
nnnnat May 3, 2018
4dfdf0b
docs: updated getCatalogProductMedia jsdocs
nnnnat May 3, 2018
0bf4b60
docs: cleaned up jsdocs for catalog util functions
nnnnat May 3, 2018
321bdf2
docs: updated catalog mutation jsdocs
nnnnat May 3, 2018
76e30ce
docs: added comment docs to publishProductsToCatalog gql mutation
nnnnat May 3, 2018
beee35c
docs: added jsdocs for some revision util functions
nnnnat May 3, 2018
63f062c
refactor: removed catalog position object from catalog code
nnnnat May 3, 2018
5a66628
refactor: removed getCatalogProductPosition util function and test
nnnnat May 3, 2018
9ad1940
fix: passsing the correct collections to the catalog util functions
nnnnat May 3, 2018
c1f28ca
refactor: updated pricing object for CatalogProducts, updated catalog…
nnnnat May 3, 2018
dbfa795
refator: updated integration test for CatalogItemProduct query to not…
nnnnat May 3, 2018
fca89b4
refactor: move compareAtPrice to catalog pricing object
aldeed May 4, 2018
a476992
chore: lint fixes
aldeed May 4, 2018
5687325
test: removed uneeded mock from publishToCatalog test
nnnnat May 4, 2018
6106f2a
fix: catalog items schema fixes
aldeed May 4, 2018
b9a106d
test: updated publishProductToCatalog test to mock the Shops.findOne …
nnnnat May 4, 2018
5661bb4
Merge branch 'refactor-4196-aldeed-catalog-schema-changes' of github.…
nnnnat May 4, 2018
ede2434
chore: fixed lintting issue
nnnnat May 4, 2018
0ddd33f
fix: use correct selector
aldeed May 4, 2018
53f4dd4
test: fixing broken integration test, created a new test file for the…
nnnnat May 4, 2018
641b123
feat: Update `getPriceRange` to format money with symbols
aldeed May 4, 2018
8000438
Merge branch 'refactor-4196-aldeed-catalog-schema-changes' of github.…
nnnnat May 4, 2018
74db34d
refactor: remove ancestorIds from catalog schema
aldeed May 4, 2018
4058dc0
Merge branch 'refactor-4196-aldeed-catalog-schema-changes' of github.…
aldeed May 4, 2018
40fc420
test: updated catalog integration test to insert the correct mock typ…
nnnnat May 4, 2018
b5f0106
Merge branch 'refactor-4196-aldeed-catalog-schema-changes' of github.…
nnnnat May 4, 2018
6251b69
docs: added jsdocs to publishProductsToCatalog mutation gql function
nnnnat May 4, 2018
7a80b33
test: updated shop mock in publishProductToCatalog test
nnnnat May 4, 2018
b2fa813
test: started integration test for publishProductToCatalog
nnnnat May 4, 2018
5389f61
chore: rename publishProductsToCatalog integration test
nnnnat May 4, 2018
c2d7a14
chore: fixed typo in mockCatalogProduct
nnnnat May 4, 2018
b07845d
test: updated expectedMockVariants to have an options child array
nnnnat May 4, 2018
f3e6466
fix: catalog item schema fixes
aldeed May 4, 2018
4dc397b
Merge branch 'refactor-4196-aldeed-catalog-schema-changes' of github.…
aldeed May 4, 2018
b65c988
chore: fix test:unit:watch command
aldeed May 4, 2018
b106a52
fix(GraphQL): issues with publishProductsToCatalog mutation
aldeed May 4, 2018
0f379f6
refactor: move xformVariant out
aldeed May 4, 2018
df74203
test: integration test for publishPorductToCatalog mution almost work…
nnnnat May 4, 2018
234d753
Merge branch 'refactor-4196-aldeed-catalog-schema-changes' of github.…
nnnnat May 4, 2018
60d5dc2
test: Added an updateOne mock method to nedb, commented out the publi…
nnnnat May 7, 2018
501c04e
chore: deleted old publishProducts.app-test.js
nnnnat May 7, 2018
c0c7527
docs: Adding and updating jsdocs for Revision util functions
nnnnat May 8, 2018
36c6902
chore: fixed linting issues
nnnnat May 8, 2018
bb3beb5
tests: use mongodb-memory-server
aldeed May 8, 2018
a44e792
Merge branch 'refactor-4196-aldeed-catalog-schema-changes' of github.…
aldeed May 8, 2018
17d340b
test: added another integration test for publishProductsToCatalog mut…
nnnnat May 8, 2018
1100ef2
test: added another publishProductsToCatalog mutation test for delete…
nnnnat May 8, 2018
1d73024
test: updated publishProductToCatalog integration test to have correc…
nnnnat May 9, 2018
436e77e
chore: removed unneeded vars from publishProductsToCatalog test
nnnnat May 9, 2018
2b0a36c
chore: cleaned up isSoldOut logic to be similar to the other inventor…
nnnnat May 10, 2018
3fc6433
refactor: created a new catalog util function getProductQuantity to r…
nnnnat May 11, 2018
9d71814
refactor: updated all catalog util functions to use the new catalog g…
nnnnat May 11, 2018
923ff11
Merge branch 'release-1.12.0' into refactor-4196-aldeed-catalog-schem…
aldeed May 12, 2018
839b992
chore: lint fix
aldeed May 12, 2018
325ca84
refactor: renamed a Catalog util function and updated it's usage in t…
nnnnat May 14, 2018
cff31ab
test: fixed function import for updateCatalogProductInventoryStatus f…
nnnnat May 14, 2018
884dbe0
refactor: moved getPriceRange util function out of the revisions plug…
nnnnat May 14, 2018
8f4f7b5
test: added jasmine timeout to the publishProductsToCatalog integrati…
nnnnat May 14, 2018
c9551c0
chore: added coverage report to gitignore, fixed linting issues
nnnnat May 14, 2018
7e766da
fix publishProductsToCatalog import
jshimko May 14, 2018
4301e0a
fix: issue with migration 24
aldeed May 15, 2018
1fd6e5c
fix: updated isLowQuantity util funcitons to check the options quanti…
nnnnat May 15, 2018
5611bdf
refactor: add back catalog positions support
aldeed May 15, 2018
84d86dc
fix: catalog fixes for failing tests
aldeed May 16, 2018
b3fc4e0
chore: lint fixes
aldeed May 16, 2018
effe5ff
tests: fix failing app tests
aldeed May 17, 2018
935ce5a
Merge branch 'release-1.12.0' into refactor-4196-aldeed-catalog-schem…
aldeed May 17, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -50,3 +50,5 @@ imports/plugins/custom/*
!imports/plugins/custom/.gitkeep

.reaction/config.json

coverage/*
11 changes: 5 additions & 6 deletions .reaction/devserver/index.js
@@ -1,10 +1,11 @@
import express from "express";
import mongodb, { MongoClient } from "mongodb";
import createApolloServer from "../../imports/plugins/core/graphql/server/createApolloServer";
import defineCollections from "../../imports/plugins/core/graphql/server/defineCollections";
import methods from "./methods";
import defineCollections from "../../imports/collections/defineCollections";
import mutations from "../../imports/plugins/core/graphql/server/mutations";
import queries from "../../imports/plugins/core/graphql/server/queries";
import setUpFileCollections from "../../imports/plugins/core/files/server/no-meteor/setUpFileCollections";
import methods from "./methods";

const { MONGO_URL, ROOT_URL } = process.env;
if (!MONGO_URL) throw new Error("You must set MONGO_URL");
Expand All @@ -27,10 +28,7 @@ MongoClient.connect(dbUrl, (error, client) => {
db = client.db(dbName);
defineCollections(db, collections);

const {
downloadManager,
Media
} = setUpFileCollections({
const { downloadManager, Media } = setUpFileCollections({
absoluteUrlPrefix: ROOT_URL,
db,
Logger: { info: console.info.bind(console) },
Expand All @@ -50,6 +48,7 @@ MongoClient.connect(dbUrl, (error, client) => {
context: {
collections,
methods,
mutations,
queries
},
debug: true,
Expand Down
13 changes: 0 additions & 13 deletions client/modules/core/main.js
Expand Up @@ -651,19 +651,6 @@ export default {
return settings.settings || {};
},

/**
* @name getShopCurrency
* @method
* @memberof Core/Client
*/
getShopCurrency() {
const shop = Shops.findOne({
_id: this.shopId
});

return (shop && shop.currency) || "USD";
},

/**
* @name isPreview
* @method
Expand Down
26 changes: 0 additions & 26 deletions client/modules/i18n/currency.js
Expand Up @@ -109,32 +109,6 @@ export function formatPriceString(formatPrice, useDefaultShopCurrency) {
return price;
}

/**
* @name formatNumber
* @memberof i18n
* @method
* @param {String} currentPrice - current Price
* @return {String} return formatted number
*/
export function formatNumber(currentPrice) {
const locale = Reaction.Locale.get();
let price = currentPrice;
const format = Object.assign({}, locale.currency, {
format: "%v"
});
const shopFormat = Object.assign({}, locale.shopCurrency, {
format: "%v"
});

if (typeof locale.currency === "object" && locale.currency.rate) {
price = currentPrice * locale.currency.rate;
return accounting.formatMoney(price, format);
}

Logger.debug("currency error, fallback to shop currency");
return accounting.formatMoney(currentPrice, shopFormat);
}

/**
* _formatPrice
* private function for formatting locale currency
Expand Down
10 changes: 10 additions & 0 deletions imports/collections/rawCollections.js
@@ -0,0 +1,10 @@
import { MongoInternals } from "meteor/mongo";
import { NoMeteorMedia } from "/imports/plugins/core/files/server";
import defineCollections from "./defineCollections";

const collections = { Media: NoMeteorMedia };

const { db } = MongoInternals.defaultRemoteCollectionDriver().mongo;
defineCollections(db, collections);

export default collections;
1 change: 1 addition & 0 deletions imports/plugins/core/catalog/server/index.js
@@ -1,5 +1,6 @@
import "./i18n";
import "./methods/catalog";
import "./methods/publishProducts";

/**
* Query functions that do not import or use any Meteor packages or globals. These can be used both
Expand Down