Database-ready
This commit is contained in:
@@ -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)
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user