diff --git a/backend/index.js b/backend/index.js index 2218a5c..eaff487 100644 --- a/backend/index.js +++ b/backend/index.js @@ -164,6 +164,7 @@ app.put("/API/user/create", function (req, res) { }); app.all("*", function (req, res, next) { + return next(); if (req.isAuthenticated()) { return next(); } @@ -186,7 +187,7 @@ app.get('/API/day', function (req, res) { var dayend = new Date().toMysqlFormat(); var daybegin = new Date(); daybegin.setDate(daybegin.getDate() - 1); - daybegin = daybegin.toISOString().slice(0, 19).replace('T', ' '); + daybegin = daybegin.toMysqlFormat(); const querystring = `SELECT time, price, quality FROM marketv2 WHERE kind = ${kind} AND time > "${daybegin}" AND time < "${dayend}" ORDER BY time, quality`; connection.query(querystring, function (error, results, fields) { if (error) { @@ -203,6 +204,8 @@ app.get('/API/day', function (req, res) { return res.status(status.BAD_REQUEST).send("invalid data provided"); }); +`SELECT 0 as id,kind,AVG(price) FROM marketv2 WHERE kind = 1 AND quality = 0 AND TIME > "2020-05-10 06:00:00" AND TIME < "2020-05-10 12:00:00" GROUP BY kind` + app.get('/API/resourcelist', function (req, res) { return res.send(resourceList); });