-
Notifications
You must be signed in to change notification settings - Fork 18
Audit approach weekly review #94
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
jrobcodes
left a comment
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.
@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: { |
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 think we were going to rename field_id and field_name?
| new_value: { | ||
| type: Sequelize.STRING | ||
| }, | ||
| field_type: { |
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.
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, |
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 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'); |
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.
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 | ||
| }, | ||
|
|
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.
Omit unnecessary whitespace please.
|
|
||
| const AUTH_OPTIONS = { | ||
| successRedirect: '/items', | ||
| successRedirect: '/items/weekly', |
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 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') ) { |
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.
Remove comments
routes/items.js
Outdated
|
|
||
| Item.filterParameters( request.body ) | ||
| .then(result => { | ||
| Item.update( result, { where, individualHooks: true }) //request.body = {completed: 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.
Remove comments
routes/items.js
Outdated
| Item.filterParameters( request.body ) | ||
| .then(result => { | ||
| Item.update( result, { where, individualHooks: true }) //request.body = {completed: true} | ||
| .then( jsonResponse => { |
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.
indentation is off for the .then calls here
routes/items.js
Outdated
| // }) | ||
| // } | ||
|
|
||
| if ( request.body.hasOwnProperty('title') ){ |
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.
Not sure what these are for, please remove.
Looking for feedback on the hooks approach.