Database-ready

This commit is contained in:
2019-03-11 19:29:51 +01:00
parent 30d647fd86
commit b02a8894ca
9 changed files with 54 additions and 25 deletions
+21 -1
View File
@@ -35,4 +35,24 @@ exports.init = function(express) {
}, 1000)
return this;
}
}
exports.getItem = function(identifier, callback) {
const sql = `SELECT * FROM items WHERE identifier = '${identifier}'`
pool.query(sql, function (error, results, fields) {
if (error) throw error;
callback(results[0])
});
}
exports.getItemList = function(callback) {
const sql = `SELECT * FROM items i ORDER BY i.order ASC`
pool.query(sql, function (error, results, fields) {
if (error) throw error;
callback(results)
});
}