diff --git a/api/app/lib/routes/latestMetadata/index.js b/api/app/lib/routes/latestMetadata/index.js index 31b0ee7..3e2b191 100644 --- a/api/app/lib/routes/latestMetadata/index.js +++ b/api/app/lib/routes/latestMetadata/index.js @@ -103,11 +103,11 @@ module.exports = function (app, router, opts) { }); findOne && findOne.resourceConsumptions.map(s => { - if (!tokens && s.token) { + if (token.find(x => x == s.token)) { tokens = s.token } }) - if (tokens && (tokens == token || tokens == token[1] || tokens == token[0])) { + if (tokens && (tokens == token || tokens == token[1] || tokens == token[0])) { if (findOne.enabled) { const pool = new Pool({ user: ctx.fs.dc.orm.config.username, @@ -177,7 +177,7 @@ module.exports = function (app, router, opts) { - async function release (apps, opts) { + async function release(apps, opts) { const models = apps.fs.dc.models; @@ -199,11 +199,12 @@ module.exports = function (app, router, opts) { order: [["id", "desc"]], include: [{ model: models.ResourceConsumption, + }], distinct: true }); findOne && findOne.resourceConsumptions.map(s => { - if (!tokens && s.token) { + if (token.find(x => x == s.token)) { tokens = s.token } })