diff --git a/lib/cron-tasks/galnet-news.js b/lib/cron-tasks/galnet-news.js index d12f019..6af6aa9 100644 --- a/lib/cron-tasks/galnet-news.js +++ b/lib/cron-tasks/galnet-news.js @@ -1,7 +1,7 @@ const fs = require('fs') const { ARDENT_GALNET_NEWS_CACHE } = require('../consts') -const GALNET_NEWS_FEED = 'https://cms.zaonce.net/en-GB/jsonapi/node/galnet_article' +const GALNET_NEWS_FEED = 'https://cms.zaonce.net/en-GB/jsonapi/node/galnet_article?&sort=-published_at&page[offset]=0&page[limit]=12 ' module.exports = async () => { try { @@ -14,6 +14,7 @@ module.exports = async () => { title: item.attributes.title, text: item.attributes.body.value.replace(/\r/g, ''), slug: item.attributes.field_slug, + image: `https://hosting.zaonce.net/elite-dangerous/galnet/${item.attributes.field_galnet_image}.png`, url: `https://community.elitedangerous.com/galnet/uid/${item.attributes.field_galnet_guid}` })) diff --git a/package.json b/package.json index fc008c6..ab9e7d9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ardent-api", - "version": "4.1.0", + "version": "4.2.0", "description": "Ardent API provides access to data submitted to EDDN", "main": "index.js", "scripts": { diff --git a/router/api/commodities.js b/router/api/commodities.js index 7db691c..e3c5591 100644 --- a/router/api/commodities.js +++ b/router/api/commodities.js @@ -17,51 +17,6 @@ module.exports = (router) => { ctx.body = JSON.parse(fs.readFileSync(COMMODITIES_REPORT)).commodities }) - // deprecated - will be removed in a future update - router.get('/api/v1-beta/commodities/ticker', async (ctx, next) => { - const stations = await dbAsync.all(` - SELECT * FROM stations.stations AS s WHERE - s.stationType != 'Fleet Carrier' - AND s.stationType IS NOT NULL - GROUP BY s.stationName - ORDER BY s.updatedAt DESC - LIMIT 50`) - - const imports = [] - for (const station of stations) { - const stationImport = await dbAsync.get(` - SELECT * FROM trade.commodities as c - WHERE c.marketId = @marketId - AND (c.demand > 1000 OR c.demand = 0) - AND c.demandBracket = 3 - AND c.updatedAt > '${getISOTimestamp('-1')}' - ORDER BY c.sellPrice DESC - LIMIT 5`, { marketId: station.marketId }) - if (stationImport) imports.push(stationImport) - } - - const exports = [] - for (const station of stations) { - const stationExport = await dbAsync.get(` - SELECT * FROM trade.commodities as c - WHERE c.marketId = @marketId - AND c.stock > 1000 - AND c.stockBracket = 3 - AND c.updatedAt > '${getISOTimestamp('-1')}' - ORDER BY c.buyPrice DESC - LIMIT 5`, { marketId: station.marketId }) - if (stationExport) exports.push(stationExport) - } - - const result = [ - ...imports, - ...exports - ].sort((a, b) => a.updatedAt.localeCompare(b.updatedAt)) // Sort results by recency - .filter((obj1, i, arr) => arr.findIndex(obj2 => (obj2.marketId === obj1.marketId)) === i) // Filter so only one entry for each station - - ctx.body = result - }) - router.get('/api/v1/commodities/core-systems-1000', async (ctx, next) => { ctx.body = JSON.parse(fs.readFileSync(CORE_SYSTEMS_1000_REPORT)) })