Skip to content

Commit

Permalink
made some changes to queries is it okay to store prof pic as a url?
Browse files Browse the repository at this point in the history
  • Loading branch information
wsputnam committed Jan 12, 2018
1 parent c958b12 commit 5f9b2bb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions database/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ const getAllUsernames = function () {
};

const checkForUser = function (facebookId) {
return pool.query('SELECT * FROM users WHERE user.facebook_id = $1', [facebookId]);
return pool.query('SELECT * FROM users WHERE user.fb_id = $1', [facebookId]);
};
const insertNewFbUser = function (newUser) {
return pool.query('INSERT INTO users (facebook_id, name) VALUES ($1, $2)', [newUser.id, newUser.displayName]);
return pool.query('INSERT INTO users (fb_id, fb_name, prof_pic) VALUES ($1, $2)', [newUser.id, newUser.displayName, newUser.photo]);
}
const getUserProfile = function (userId) {
return pool.query('SELECT users.user_id, users.name, users.prof_pic, users.description FROM users \
Expand Down
3 changes: 2 additions & 1 deletion server/LogInServerModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ passport.use(new FacebookStrategy({
// if (user.length === 0) {
// var newUser = {
// "id": profile.id,
// "username": profile.displayName
// "username": profile.displayName,
// "photo": profile.photos[0].value
// }
// db.query('INSERT INTO users (user_id, name) values (?, ?)', [newUser.id, newUser.username], function(err, user) {
// if (err) {
Expand Down

0 comments on commit 5f9b2bb

Please sign in to comment.