aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarvin Borner2020-09-28 20:10:10 +0200
committerMarvin Borner2020-09-28 20:10:29 +0200
commit4f6fe9fc1033e388c5cdf1dab6afa799547b30ef (patch)
tree5408f168efac2ebd3713c85802f7639d54d0a072
parentef30849d550fd2039a1459ad9e03635c966e221b (diff)
Added hidden attribute
-rw-r--r--motto/index.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/motto/index.js b/motto/index.js
index 423a19a..ec14a33 100644
--- a/motto/index.js
+++ b/motto/index.js
@@ -23,7 +23,7 @@ function create_db() {
});
db.run(
- "CREATE TABLE IF NOT EXISTS theme(id INTEGER PRIMARY KEY AUTOINCREMENT, main TEXT NOT NULL, description TEXT NOT NULL, votes INTEGER DEFAULT 0, UNIQUE(main, description))",
+ "CREATE TABLE IF NOT EXISTS theme(id INTEGER PRIMARY KEY AUTOINCREMENT, main TEXT NOT NULL, description TEXT NOT NULL, votes INTEGER DEFAULT 0, hidden BOOL DEFAULT 0 UNIQUE(main, description))",
(err) => {
if (err) console.error(err.message);
}
@@ -60,7 +60,7 @@ app.use("/", express.static(__dirname + "/public"));
app.use("/api/", apiLimiter);
app.get("/api/list", (req, res) => {
- db.all("SELECT * FROM theme ORDER BY votes DESC", (err, all) => {
+ db.all("SELECT * FROM theme WHERE hidden = 0 ORDER BY votes DESC", (err, all) => {
if (err) {
res.send("error");
console.error(err.message);