Skip to content

Commit

Permalink
Merge pull request #4218 from reactioncommerce/refactor-4196-aldeed-c…
Browse files Browse the repository at this point in the history
…atalog-schema-changes

Catalog schema changes
  • Loading branch information
aldeed authored May 17, 2018
2 parents 781da49 + 935ce5a commit 7e3ad6e
Show file tree
Hide file tree
Showing 104 changed files with 8,228 additions and 4,473 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
File renamed without changes.
10 changes: 10 additions & 0 deletions imports/collections/rawCollections.js
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit 7e3ad6e

Please sign in to comment.