From da9fc1f4a1b3a2064d814567b73b7d1b1aaebf22 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Wed, 10 Jul 2019 23:34:37 -0400 Subject: [PATCH] Made it save the time the data was submitted (in unix time) --- index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index ab6532a..31dc6c8 100644 --- a/index.js +++ b/index.js @@ -80,13 +80,16 @@ app.get('/api/postVideoSponsorTimes', function (req, res) { let UUID = uuidv1(); + //get current time + let timeSubmitted = Date.now(); + //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) { if (err) console.log(err); if (row == null) { //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); } else {