Skip to content

Commit

Permalink
Merge pull request #252 from the-hideout/historical-price-min
Browse files Browse the repository at this point in the history
add min price to historical price query
  • Loading branch information
Razzmatazzz authored Dec 3, 2023
2 parents 372555f + dffcadd commit abc8978
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 19 deletions.
25 changes: 9 additions & 16 deletions datasources/status.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,21 @@ const statusMap = [
'Down',
];

async function gatherResponse(response) {
let responseOutput = false;
try {
const responseData = await response.json();

responseOutput = responseData;
} catch (jsonError) {
console.error('Error processing JSON for status request', jsonError);
}

return responseOutput;
};

async function handleRequest(url) {
const init = {
headers: {
'accept': 'application/json, text/plain, */*',
},
};
const response = await fetch(url, init);

return await gatherResponse(response);
return fetch(url, init).then(response => {
return response.json().catch(error => {
console.error(`Error parsing ${url} json: ${error.message}`);
return false;
});
}).catch(error => {
console.error(`Error retrieving ${url} status: ${error.message}`);
return false;
});
};

module.exports = async () => {
Expand Down
1 change: 1 addition & 0 deletions schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ type HideoutStationLevel {
type historicalPricePoint {
price: Int
priceMin: Int
timestamp: String
}
Expand Down
6 changes: 3 additions & 3 deletions script/ci/Tarkov.dev.postman_collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@
"\r",
"pm.test(\"Has correct data\", function () {\r",
" pm.expect(pm.response.text()).to.include(\"messages\");\r",
" pm.expect(pm.response.text()).to.include(\"Website\");\r",
" pm.expect(pm.response.text()).to.include(\"Global\");\r",
"});\r",
"\r",
"pm.test(\"No errors\", function () {\r",
Expand Down Expand Up @@ -650,8 +650,8 @@
" pm.expect(pm.response.json().data.itemsByName[0].sellFor).to.be.a(\"array\");\r",
"});\r",
"\r",
"pm.test(\"correct item types to be an array\", function () {\r",
" pm.expect(pm.response.json().data.itemsByName[0].hasGrid).to.eq(null);\r",
"pm.test(\"correct item hasGrid value\", function () {\r",
" pm.expect(pm.response.json().data.itemsByName[0].hasGrid).to.eq(false);\r",
"});\r",
"\r",
"pm.test(\"recoilModifier should be null for a non-weapon item\", function () {\r",
Expand Down

0 comments on commit abc8978

Please sign in to comment.