traxxx/src/tags.js

12 lines
355 B
JavaScript
Raw Normal View History

'use strict';
const knex = require('./knex');
async function matchTags(rawTags) {
const tagEntries = await knex('tags').whereIn('tags.tag', rawTags.map(tag => tag.toLowerCase()));
2019-09-10 14:48:04 +00:00
return Array.from(new Set(tagEntries.map((tag => tag.alias_for || tag.id)).sort())); // reduce to tag name and filter duplicates
}
module.exports = { matchTags };