Skip to content

Commit

Permalink
adds extra log statements to DB model files
Browse files Browse the repository at this point in the history
related #319
  • Loading branch information
emilyb7 committed Sep 1, 2017
1 parent e6d4942 commit bc89750
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion server/model/add-goal.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ const { getNewGoalData, } = require('./../helpers/handle-goals.js');

module.exports = (goal, userId, cb) => {
const data = getNewGoalData(goal, userId);
dbClient.query(queries.insertGoal, data, (dbErr) => {
dbClient.query(queries.insertGoal, data, dbErr => {
if (dbErr) {
console.log(dbErr); // eslint-disable-line no-console
return cb('error adding new goal to database ' + dbErr);
}
cb(null, goal.id);
Expand Down
3 changes: 2 additions & 1 deletion server/model/get-user.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ const dbClient = require('./../database/db_connection.js');
const queries = require('./../database/queries.js');

module.exports = (userId, callback) => {

dbClient.query(queries.getUserById, [ userId, ], (getErr, result) => {
if (getErr) {
console.log(getErr); // eslint-disable-line no-console
return callback('database error while retrieving user details');
}

Expand All @@ -15,6 +15,7 @@ module.exports = (userId, callback) => {

dbClient.query(queries.insertUser, [ userId, ], (insertErr, newUser) => {
if (insertErr) {
console.log(insertErr); // eslint-disable-line no-console
return callback('unable to create new user');
}

Expand Down

0 comments on commit bc89750

Please sign in to comment.