diff --git a/app.js b/app.js index 6f339db..e9f2810 100644 --- a/app.js +++ b/app.js @@ -58,35 +58,3 @@ app.use(DASHBOARDS_ROUTER); app.use('/Users', USERS_ROUTER); app.use('/Queue', QUEUE_ROUTER); app.use('/Api', API_ROUTER); - - -// app.post('/saveQueData', function(req, res) { -// data = req.body; -// var id = data.djID; -// var Title = data.Title; -// var Artist = data.Artist; -// var Album = data.Album; -// var Image = data.Image; -// var userID = req.session.user.id; - // db.none('INSERT INTO QUE (title,artist,album,img,djs_id,fans_id) VALUES ($1,$2,$3,$4,$5,$6)', [Title, Artist, Album, Image, id, userID]).then(function() { - // res.send("Song Added!") - // }) -// -// }); -// -// app.delete('/deleteQueData', function(req, res) { -// var user = req.session.user.id; -// var songID = req.body.songID; -// console.log(req.body.songID); -// db.none('DELETE FROM que WHERE id = $1 AND djs_id = $2', [songID, user]).then(function() { -// console.log("Song Deleted"); -// }); -// }); -// -// app.get('/queData', function(req, res) { -// var userID = req.session.user.id; -// db.any('SELECT * FROM que WHERE djs_id = $1', [userID]) -// .then(function(data) { -// res.send(data); -// }) -// }); diff --git a/models/Queue.js b/models/Queue.js index f5a4045..35c67e9 100644 --- a/models/Queue.js +++ b/models/Queue.js @@ -18,6 +18,7 @@ const getOneQueue = (req, res, next) => { // Adds songs to users que in database const addToQueue = (req, res, next) => { const data = req.body; + console.log(data); const id = data.djID; const Title = data.Title; const Artist = data.Artist; @@ -25,13 +26,15 @@ const addToQueue = (req, res, next) => { const Image = data.Image; const userID = req.session.user.id; + console.log(req) + db.none('INSERT INTO QUE (title,artist,album,img,djs_id,fans_id) VALUES ($1,$2,$3,$4,$5,$6)', [Title, Artist, Album, Image, id, userID]) .then(() => { next(); }) .catch((err) => { console.log(err); - res.send('Ohh oh something went wrong with adding your song to the queue!'); + res.write('Ohh oh something went wrong with adding your song to the queue!'); }) } diff --git a/models/User.js b/models/User.js index 1ad9c7b..283bedf 100644 --- a/models/User.js +++ b/models/User.js @@ -93,7 +93,6 @@ const getUserByName = (req, res, next) => { .catch((err) => { res.send('Something went wrong!'); console.log(err); - next(); }) } diff --git a/public/scripts/userboard.js b/public/scripts/userboard.js index 8c764b4..ecf3cca 100644 --- a/public/scripts/userboard.js +++ b/public/scripts/userboard.js @@ -75,7 +75,7 @@ const appendDom = (data) => { let location = value.location; let bio = value.bio; - $('#listDjs').append('
' + bio+ '
' +'- ' + ''+ location + '' +'
' + bio+ '
' +'- ' + ''+ location + '' +'
DJ# - {{user.id}}
Bio - {{user.bio}}
Location - {{user.location}}
Up Votes - {{user.upvotes}}
Down Votes - {{user.downvotes}}