Skip to content

Commit d3a7224

Browse files
Merge pull request #43 from wednesday-solutions/feat/camelcased-models
feat: camelcased mongo-models
2 parents 772d9da + 5bb2d43 commit d3a7224

File tree

15 files changed

+577
-758
lines changed

15 files changed

+577
-758
lines changed

.env.example

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ API_AUDIENCE=https://node-express-demo
1818
REDIS_PORT=6379
1919
REDIS_DOMAIN=localhost
2020
MONGO_PORT=27017
21-
MONGO_BASE_URI=localhost
21+
MONGO_BASE_URI=localhost
22+
MONGO_DB_NAME=ecommerce

.env.test

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@ NODE_ENV=test
2020
REDIS_PORT=6379
2121
REDIS_DOMAIN=localhost
2222
MONGO_PORT=27017
23-
MONGO_BASE_URI=localhost
23+
MONGO_BASE_URI=localhost
24+
MONGO_DB_NAME=ecommerce

models/referencedOrders.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ const schema = new mongoose.Schema({
77
}
88
});
99

10-
const ReferencedOrders = mongoose.model('referenced_orders', schema);
10+
const ReferencedOrders = mongoose.model('referencedOrders', schema);
1111

1212
module.exports = { model: ReferencedOrders, ReferencedOrders, schema };

models/storeProducts.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ const schema = new mongoose.Schema({
1818
}
1919
});
2020

21-
const StoreProducts = mongoose.model('store_products', schema);
21+
const StoreProducts = mongoose.model('storeProducts', schema);
2222
module.exports = { model: StoreProducts, StoreProducts, schema };

models/supplierProducts.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ const schema = new mongoose.Schema({
1818
}
1919
});
2020

21-
const SupplierProducts = mongoose.model('supplier_products', schema);
21+
const SupplierProducts = mongoose.model('supplierProducts', schema);
2222
module.exports = { model: SupplierProducts, SupplierProducts, schema };

models/unshardedOrders.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ const schema = new mongoose.Schema({
88
}
99
});
1010

11-
const UnshardedOrders = mongoose.model('unsharded_orders', schema);
11+
const UnshardedOrders = mongoose.model('unshardedOrders', schema);
1212

1313
module.exports = { model: UnshardedOrders, UnshardedOrders, schema };

models/unshardedReferencedOrders.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const schema = new mongoose.Schema({
88
});
99

1010
const UnshardedReferencedOrders = mongoose.model(
11-
'unsharded_referenced_orders',
11+
'unshardedReferencedOrders',
1212
schema
1313
);
1414

nodemon.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"exec": "export ENVIRONMENT_NAME=local && yarn start",
3+
"watch": ["server/*"],
4+
"ignore": ["**/__tests__/**", "*.test.js"],
5+
"events": {
6+
"restart": "kill-port 9000",
7+
"crash": "kill-port 9000 && npm run local"
8+
},
9+
"delay": "250"
10+
}

package.json

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"start": "export ENVIRONMENT_NAME=local && nodemon --exec babel-node app.js | bunyan -o short",
99
"start:sharded": "export MONGO_PORT=60000 && yarn start",
1010
"postinstall": "link-module-alias",
11-
"preinstall": "command -v link-module-alias && link-module-alias clean || true",
11+
"preinstall": "source /usr/local/opt/nvm/nvm.sh; nvm use; command -v link-module-alias && link-module-alias clean || true",
1212
"format": "prettier-standard './**/**/*.js'",
1313
"lint": "npm run lint:js",
1414
"lint:eslint": "eslint --ignore-path .gitignore --ignore-pattern server/bin",
@@ -47,16 +47,15 @@
4747
"body-parser": "^1.19.1",
4848
"bull": "^4.8.1",
4949
"bunyan": "^1.8.15",
50-
"core-js": "^3.20.2",
5150
"cors": "^2.8.5",
5251
"dotenv": "^16.0.0",
5352
"express": "^4.17.2",
5453
"express-jwt": "^6.1.1",
55-
"express-jwt-authz": "^2.4.1",
5654
"express-rate-limit": "^6.3.0",
5755
"express-validator": "^6.14.0",
5856
"helmet": "^5.0.1",
5957
"husky": "^7.0.4",
58+
"ioredis": "^5.0.5",
6059
"jwks-rsa": "^2.0.5",
6160
"kill-port": "^1.6.1",
6261
"lodash": "^4.17.21",
@@ -68,35 +67,25 @@
6867
"opossum": "^6.3.0",
6968
"pluralize": "^8.0.0",
7069
"response-time": "^2.3.2",
71-
"save": "^2.4.0",
7270
"slack-notify": "^2.0.2",
73-
"swagger-ui-express": "^4.3.0"
71+
"swagger-ui-express": "^4.3.0",
72+
"uuid": "^8.3.2"
7473
},
7574
"devDependencies": {
76-
"@babel/cli": "^7.16.7",
7775
"@babel/core": "^7.16.7",
78-
"@babel/eslint-parser": "^7.5.4",
76+
"@babel/eslint-parser": "^7.18.2",
7977
"@babel/node": "^7.16.7",
80-
"@babel/preset-env": "^7.16.7",
78+
"@babel/preset-env": "^7.18.2",
8179
"@faker-js/faker": "^6.0.0-alpha.5",
82-
"@types/jest": "^27.4.1",
83-
"babel-eslint": "^10.1.0",
8480
"eslint": "^8.6.0",
85-
"eslint-config-prettier": "^4.1.0",
86-
"eslint-config-prettier-standard": "^3.0.1",
87-
"eslint-config-standard": "^14.1.0",
88-
"eslint-plugin-import": "^2.17.2",
89-
"eslint-plugin-node": "^10.0.0",
81+
"eslint-config-prettier": "^8.5.0",
9082
"eslint-plugin-prettier": "^4.0.0",
91-
"eslint-plugin-promise": "^4.2.1",
92-
"eslint-plugin-standard": "^4.0.1",
93-
"git-commit-msg-linter": "^4.1.2",
9483
"jest": "^27.4.7",
9584
"jest-coverage-badges": "^1.1.2",
9685
"link-module-alias": "^1.2.0",
9786
"mockingoose": "^2.15.2",
98-
"pre-commit": "1.2.2",
99-
"prettier": "^2.5.1",
87+
"pre-commit": "^1.2.2",
88+
"prettier": "^2.6.2",
10089
"prettier-standard": "^16.4.1",
10190
"supertest": "^6.2.2"
10291
},

server/api/referencedOrders/tests/index.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ describe('fetchAllReferencedOrders tests', () => {
1111
let mockingoose;
1212

1313
beforeAll(() => {
14-
MODEL_NAME = 'referenced_orders';
14+
MODEL_NAME = 'referencedOrders';
1515
ENDPOINT = `/${kebabCase(MODEL_NAME)}`;
1616
});
1717

0 commit comments

Comments
 (0)