projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
More verbose instructions for creating sqlite database
[vchess.git]
/
server
/
models
/
News.js
diff --git
a/server/models/News.js
b/server/models/News.js
index
3fa3caa
..
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,9
+30,10
@@
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);
});
});
@@
-46,7
+47,7
@@
const NewsModel =
"FROM News " +
"ORDER BY added DESC " +
"LIMIT 1";
"FROM News " +
"ORDER BY added DESC " +
"LIMIT 1";
- db.get(query, (err,ts) => {
+ db.get(query, (err,
ts) => {
cb(err, ts);
});
});
cb(err, ts);
});
});