Made it save the time the data was submitted (in unix time)

This commit is contained in:
Ajay Ramachandran
2019-07-10 23:34:37 -04:00
parent 12745531e2
commit da9fc1f4a1

View File

@@ -80,13 +80,16 @@ app.get('/api/postVideoSponsorTimes', function (req, res) {
let UUID = uuidv1(); let UUID = uuidv1();
//get current time
let timeSubmitted = Date.now();
//check if this info has already been submitted first //check if this info has already been submitted first
db.prepare("SELECT UUID From sponsorTimes WHERE startTime = ? and endTime = ? and videoID = ?").get([startTime, endTime, videoID], function(err, row) { db.prepare("SELECT UUID From sponsorTimes WHERE startTime = ? and endTime = ? and videoID = ?").get([startTime, endTime, videoID], function(err, row) {
if (err) console.log(err); if (err) console.log(err);
if (row == null) { if (row == null) {
//not a duplicate, execute query //not a duplicate, execute query
db.prepare("INSERT INTO sponsorTimes VALUES(?, ?, ?, ?, ?, ?)").run(videoID, startTime, endTime, UUID, userID, hashedIP); db.prepare("INSERT INTO sponsorTimes VALUES(?, ?, ?, ?, ?, ?, ?)").run(videoID, startTime, endTime, UUID, userID, hashedIP, timeSubmitted);
res.sendStatus(200); res.sendStatus(200);
} else { } else {