Skip to content

Conversation

@phoniks
Copy link

@phoniks phoniks commented Nov 2, 2016

Looking for feedback on the hooks approach.

Copy link
Contributor

@jrobcodes jrobcodes left a comment

Choose a reason for hiding this comment

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

@phoniks looks like you're on the right path! Some comments about formatting and a lot of console.logs and comments. Please ensure you are not arbitrarily adding changes to files that do not relate to your feature (there was a file or two that had new whitespace, or whitespace removed, where it should not have been)

table_name: {
type: Sequelize.STRING
},
field_id: {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we were going to rename field_id and field_name?

new_value: {
type: Sequelize.STRING
},
field_type: {
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably field_type too.

models/audit.js Outdated
module.exports = function(sequelize, DataTypes) {
var Audit = sequelize.define('Audit', {
table_name: DataTypes.STRING,
field_id: DataTypes.STRING,
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comments as for migration, probably need to regenerate the model to correct the names of properties.

models/item.js Outdated
// user.username = 'Toni'
// },
afterUpdate: function(item, options) {
const Audit = sequelize.import('../models/audit');
Copy link
Contributor

Choose a reason for hiding this comment

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

We should import this at the top of this module, so that it need not be re-imported for every execution of this hook.

parent_id: DataTypes.INTEGER,
user_id: DataTypes.INTEGER
},

Copy link
Contributor

Choose a reason for hiding this comment

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

Omit unnecessary whitespace please.


const AUTH_OPTIONS = {
successRedirect: '/items',
successRedirect: '/items/weekly',
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a very surprising change - why does authentication change to a weekly route?

routes/items.js Outdated
.catch( error => response.json({ success: false, id, message: error.message }))
})

// if ( request.body.hasOwnProperty('completed') ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove comments

routes/items.js Outdated

Item.filterParameters( request.body )
.then(result => {
Item.update( result, { where, individualHooks: true }) //request.body = {completed: true}
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove comments

routes/items.js Outdated
Item.filterParameters( request.body )
.then(result => {
Item.update( result, { where, individualHooks: true }) //request.body = {completed: true}
.then( jsonResponse => {
Copy link
Contributor

Choose a reason for hiding this comment

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

indentation is off for the .then calls here

routes/items.js Outdated
// })
// }

if ( request.body.hasOwnProperty('title') ){
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure what these are for, please remove.

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.

2 participants