Generalized tags to allow them to be assigned to anything.

This commit is contained in:
2019-12-07 04:41:16 +01:00
parent 85c2654add
commit 222260d3cf
4 changed files with 28 additions and 18 deletions

View File

@@ -1545,13 +1545,13 @@ exports.seed = knex => Promise.resolve()
return upsert('tags_groups', groups, duplicatesBySlug, 'slug', knex);
})
.then(async () => {
const [duplicates, groups] = await Promise.all([
const [duplicates, groupEntries] = await Promise.all([
knex('tags').select('*'),
knex('tags_groups').select('*'),
]);
const duplicatesBySlug = duplicates.reduce((acc, tag) => ({ ...acc, [tag.slug]: tag }), {});
const groupsMap = groups.reduce((acc, { id, slug }) => ({ ...acc, [slug]: id }), {});
const groupsMap = groupEntries.reduce((acc, { id, slug }) => ({ ...acc, [slug]: id }), {});
const tags = getTags(groupsMap);