-
Couldn't load subscription status.
- Fork 0
Initialmodels #5
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
base: master
Are you sure you want to change the base?
Conversation
models/categories.js
Outdated
| @@ -0,0 +1,13 @@ | |||
| 'use strict'; | |||
| module.exports = (sequelize, DataTypes) => { | |||
| var categories = sequelize.define('categories', { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use const rather than var on all model files
models/categories.js
Outdated
| var categories = sequelize.define('categories', { | ||
| name: DataTypes.STRING | ||
| }, { | ||
| classMethods: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think sequelize is using classMethods anymore. If you checkout voting, the association is done outside of the sequelize.define parenthesis.
models/item.js
Outdated
| name: DataTypes.STRING | ||
| }, { | ||
| classMethods: { | ||
| item.associate: function(models) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this should be outside of the parenthesis, the association statement should look like item.associate = (models) => { Here we are using a lambda instead of function.
models/menuitem.js
Outdated
| size: DataTypes.INTEGER | ||
| price: DataTypes.INTEGER | ||
| }, { | ||
| classMethods: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as others, not using classMethods.
models/menuitem.js
Outdated
| price: DataTypes.INTEGER | ||
| }, { | ||
| classMethods: { | ||
| menuitem.associate: function(models) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as others, use lambda
models/orders.js
Outdated
| email: DataTypes.STRING, | ||
| total_cost: DataTypes.FLOAT | ||
| }, { | ||
| classMethods: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as others
models/toppings.js
Outdated
| name: DataTypes.STRING, | ||
| price_extra: DataTypes.FLOAT | ||
| }, { | ||
| classMethods: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as others
|
Made the lambda changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't download and run this, but there are lots of issues with code style that need to be addressed before going over the actual logic. Make some changes, and poke me to take another look at it.
| 'use strict' | ||
| module.exports = { | ||
| up: (queryInterface, Sequelize) => { | ||
| return queryInterface.createTable('order', { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you're standardizing on lowercase for table names, that's fine, just be consistent. Some people prefer to caps the first letter, called PascalCase, but if you'd rather do it this way it's ok. Just want to point out the implicit decision being made here.
migrations/2-create-category.js
Outdated
| down: (queryInterface, Sequelize) => { | ||
| return queryInterface.dropTable('category'); | ||
| } | ||
| }; No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a newline at the end of this file.
migrations/3-create-menuitem.js
Outdated
| type: Sequelize.STRING | ||
| }, | ||
| latenight:{ | ||
| type: Sequelize.STRING |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these be STRING? To me they make more sense as BOOLEAN.
migrations/3-create-menuitem.js
Outdated
| down: (queryInterface, Sequelize) => { | ||
| return queryInterface.dropTable('menuitem'); | ||
| } | ||
| }; No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newline
migrations/3-create-menuitem.js
Outdated
| 'use strict'; | ||
| module.exports = { | ||
| up: (queryInterface, Sequelize) => { | ||
| return queryInterface.createTable('menuitem', { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should either be camelCase, or use under_scores. It's hard to read with alllowercase.
migrations/6-associate-item-order.js
Outdated
| module.exports = { | ||
| up: (queryInterface, Sequelize) => { | ||
| return queryInterface.createTable( | ||
| 'item-order', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Standardize on a naming convention please.
migrations/6-associate-item-order.js
Outdated
| allowNull: false, | ||
| type: Sequelize.DATE, | ||
| }, | ||
| ItemId: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PascalCase?
| }, | ||
| ItemId: { | ||
| type: Sequelize.INTEGER, | ||
| primaryKey: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should only be one primary key on a table.
| module.exports = (sequelize, DataTypes) => { | ||
| const category = sequelize.define('category', { | ||
| name: DataTypes.STRING | ||
| }, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix indentation
models/category.js
Outdated
| // associations can be defined here | ||
| } | ||
| return category; | ||
| } No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newline
config/config.json
Outdated
| "development": { | ||
| "username": "root", | ||
| "password": null, | ||
| "password": "mysqlpassword", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason for this? It is better to leave it to null, since most developers do not put a password on their development database.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no particular reason for this, I'll change it to null
routes/orders.js
Outdated
| * @apiSuccess {String} description A description of the action | ||
| * @apiSuccess {Number} duration Duration, in seconds, of the action | ||
| * @apiSuccess {Number} assetId The asset that this action is associated with, if any | ||
| * @apiSuccess {Number} redValue If this is a background color changing action, the value of red that should be used. Should be between 0-255. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be here, copy/paste leftovers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I already updated the routes. Can you see the new changes?
No description provided.