projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add translations for Ambiguous chess
[vchess.git]
/
server
/
models
/
News.js
diff --git
a/server/models/News.js
b/server/models/News.js
index
12f4bf5
..
c10f71f
100644
(file)
--- a/
server/models/News.js
+++ b/
server/models/News.js
@@
-19,7
+19,7
@@
const NewsModel =
"VALUES " +
"(" + Date.now() + "," + uid + ",?)";
db.run(query, content, function(err) {
"VALUES " +
"(" + Date.now() + "," + uid + ",?)";
db.run(query, content, function(err) {
- cb(err, {
nid: this.lastID
});
+ cb(err, {
id: this.lastID
});
});
});
},
});
});
},
@@
-30,14
+30,29
@@
const NewsModel =
const query =
"SELECT * " +
"FROM News " +
const query =
"SELECT * " +
"FROM News " +
- "WHERE id > " + cursor + " " +
+ "WHERE added < " + cursor + " " +
+ "ORDER BY added DESC " +
"LIMIT 10"; //TODO: 10 currently hard-coded
"LIMIT 10"; //TODO: 10 currently hard-coded
- db.all(query, (err,newsList) => {
+ db.all(query, (err,
newsList) => {
cb(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() {
update: function(news)
{
db.serialize(function() {