Added support for receiving a userID

This commit is contained in:
Ajay Ramachandran
2019-07-10 19:25:49 -04:00
parent b2a54716c9
commit 16b2b22bc0

View File

@@ -53,8 +53,9 @@ app.get('/api/postVideoSponsorTimes', function (req, res) {
let videoID = req.query.videoID;
let startTime = req.query.startTime;
let endTime = req.query.endTime;
let userID = req.query.userID;
if (typeof videoID != 'string' || startTime == undefined || endTime == undefined) {
if (typeof videoID != 'string' || startTime == undefined || endTime == undefined || userID == undefined) {
//invalid request
res.sendStatus(400);
return;
@@ -65,7 +66,7 @@ app.get('/api/postVideoSponsorTimes', function (req, res) {
let UUID = uuidv1();
db.prepare("INSERT INTO sponsorTimes VALUES(?, ?, ?, ?)").run(videoID, startTime, endTime, UUID);
db.prepare("INSERT INTO sponsorTimes VALUES(?, ?, ?, ?, ?)").run(videoID, startTime, endTime, UUID, userID);
res.sendStatus(200);
});