Skip to content

Conversation

@NadiaMouldi
Copy link

No description provided.

@@ -0,0 +1,13 @@
'use strict';
module.exports = (sequelize, DataTypes) => {
var categories = sequelize.define('categories', {
Copy link
Contributor

@erichkauffman erichkauffman Jan 5, 2018

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

var categories = sequelize.define('categories', {
name: DataTypes.STRING
}, {
classMethods: {
Copy link
Contributor

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) {
Copy link
Contributor

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.

size: DataTypes.INTEGER
price: DataTypes.INTEGER
}, {
classMethods: {
Copy link
Contributor

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.

price: DataTypes.INTEGER
}, {
classMethods: {
menuitem.associate: function(models) {
Copy link
Contributor

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: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as others

name: DataTypes.STRING,
price_extra: DataTypes.FLOAT
}, {
classMethods: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as others

@NadiaMouldi
Copy link
Author

Made the lambda changes.

Copy link
Member

@elijahverdoorn elijahverdoorn left a 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', {
Copy link
Member

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.

down: (queryInterface, Sequelize) => {
return queryInterface.dropTable('category');
}
}; No newline at end of file
Copy link
Member

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.

type: Sequelize.STRING
},
latenight:{
type: Sequelize.STRING
Copy link
Member

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.

down: (queryInterface, Sequelize) => {
return queryInterface.dropTable('menuitem');
}
}; No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newline

'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('menuitem', {
Copy link
Member

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.

module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.createTable(
'item-order',
Copy link
Member

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.

allowNull: false,
type: Sequelize.DATE,
},
ItemId: {
Copy link
Member

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,
Copy link
Member

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
}, {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix indentation

// associations can be defined here
}
return category;
} No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newline

"development": {
"username": "root",
"password": null,
"password": "mysqlpassword",
Copy link
Member

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.

Copy link
Author

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.
Copy link
Member

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.

Copy link
Author

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants