"VALUES " +
"(" + Date.now() + "," + uid + ",?)";
db.run(query, content, function(err) {
- cb(err, {nid: this.lastID});
+ cb(err, { id: this.lastID });
});
});
},
const query =
"SELECT * " +
"FROM News " +
- "WHERE id > " + cursor + " " +
+ "WHERE added < " + cursor + " " +
+ "ORDER BY added DESC " +
"LIMIT 10"; //TODO: 10 currently hard-coded
- db.all(query, (err,newsList) => {
+ db.all(query, (err, newsList) => {
cb(err, newsList);
});
});
},
+ getTimestamp: function(cb)
+ {
+ db.serialize(function() {
+ const query =
+ "SELECT added " +
+ "FROM News " +
+ "ORDER BY added DESC " +
+ "LIMIT 1";
+ db.get(query, (err, ts) => {
+ cb(err, ts);
+ });
+ });
+ },
+
update: function(news)
{
db.serialize(function() {