kursadzija
All checks were successful
Deploy bot / build-and-deploy (push) Successful in 24s

This commit is contained in:
2025-08-27 16:53:17 +02:00
parent d163a03225
commit 3bfd995e3a
14 changed files with 53 additions and 18 deletions

View File

@ -138,20 +138,24 @@ export const get = async (req, res) => {
const combined = req.query.q;
if (!combined || combined.replace(" ", "").length == 0)
return res.status(400).json({ error: "Missing query." });
return res.status(400).json({ error: "missing-query" });
let entryFound = false;
let estimatedPrice = 0;
let subtable, closestInTable;
let gameValue = 0;
let gameValue = -1;
let returnKeyWord = "";
combined.split(" ").forEach((arg) => {
if (!isNaN(parseInt(arg)) && !gameValue) {
if (!isNaN(parseInt(arg)) && gameValue == -1) {
gameValue = parseInt(arg);
}
});
if (gameValue == -1) {
return res.status(400).json({ error: "gameValue-not-found" });
}
priceTable.forEach((price, idx) => {
if (price.regex.test(combined) && !entryFound) {
entryFound = true;
@ -183,8 +187,5 @@ export const get = async (req, res) => {
closestInTable,
});
}
} else
return res
.status(400)
.json({ error: "Query could not be matched with anything." });
} else return res.status(400).json({ error: "entry-not-found" });
};