Refactor models (merge Players in Games), add cursor to correspondance games. Finishe...
[vchess.git] / server / models / News.js
index 3fa3caa..2dde566 100644 (file)
@@ -19,7 +19,7 @@ const NewsModel =
           "VALUES " +
         "(" + Date.now() + "," + uid + ",?)";
       db.run(query, content, function(err) {
-        cb(err, {nid: this.lastID});
+        cb(err, { id: this.lastID });
       });
     });
   },
@@ -30,7 +30,8 @@ const NewsModel =
       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) => {
         cb(err, newsList);