Compare commits
2 Commits
64e9efe095
...
e0908a5f5e
Author | SHA1 | Date |
---|---|---|
|
e0908a5f5e | |
|
f0b7678444 |
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "traxxx",
|
"name": "traxxx",
|
||||||
"version": "1.201.1",
|
"version": "1.201.2",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "traxxx",
|
"name": "traxxx",
|
||||||
"version": "1.201.1",
|
"version": "1.201.2",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@casl/ability": "^5.2.2",
|
"@casl/ability": "^5.2.2",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "traxxx",
|
"name": "traxxx",
|
||||||
"version": "1.201.1",
|
"version": "1.201.2",
|
||||||
"description": "All the latest porn releases in one place",
|
"description": "All the latest porn releases in one place",
|
||||||
"main": "src/app.js",
|
"main": "src/app.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
@ -2021,13 +2021,13 @@ const aliases = [
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
exports.seed = knex => Promise.resolve()
|
exports.seed = (knex) => Promise.resolve()
|
||||||
.then(async () => upsert('tags_groups', groups, 'slug', knex))
|
.then(async () => upsert('tags_groups', groups, 'slug', knex))
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
const groupEntries = await knex('tags_groups').select('*');
|
const groupEntries = await knex('tags_groups').select('*');
|
||||||
const groupsMap = groupEntries.reduce((acc, { id, slug }) => ({ ...acc, [slug]: id }), {});
|
const groupsMap = groupEntries.reduce((acc, { id, slug }) => ({ ...acc, [slug]: id }), {});
|
||||||
|
|
||||||
const tagsWithGroups = tags.map(tag => ({
|
const tagsWithGroups = tags.map((tag) => ({
|
||||||
name: tag.name,
|
name: tag.name,
|
||||||
slug: tag.slug || slugify(tag.name),
|
slug: tag.slug || slugify(tag.name),
|
||||||
description: tag.description,
|
description: tag.description,
|
||||||
|
@ -2042,7 +2042,7 @@ exports.seed = knex => Promise.resolve()
|
||||||
const tagEntries = await knex('tags').select('*').where({ alias_for: null });
|
const tagEntries = await knex('tags').select('*').where({ alias_for: null });
|
||||||
const tagsMap = tagEntries.reduce((acc, { id, slug }) => ({ ...acc, [slug]: id }), {});
|
const tagsMap = tagEntries.reduce((acc, { id, slug }) => ({ ...acc, [slug]: id }), {});
|
||||||
|
|
||||||
const tagAliases = aliases.map(alias => ({
|
const tagAliases = aliases.map((alias) => ({
|
||||||
name: alias.name,
|
name: alias.name,
|
||||||
alias_for: tagsMap[alias.for],
|
alias_for: tagsMap[alias.for],
|
||||||
secondary: !!alias.secondary,
|
secondary: !!alias.secondary,
|
||||||
|
|
|
@ -33,8 +33,8 @@ async function upsert(table, items, identifier = ['id'], _knex) {
|
||||||
logger.debug(`${table}: Updating ${update.length}`);
|
logger.debug(`${table}: Updating ${update.length}`);
|
||||||
|
|
||||||
const [inserted, updated] = await Promise.all([
|
const [inserted, updated] = await Promise.all([
|
||||||
knex(table).returning('*').insert(insert),
|
insert.length > 0 ? knex(table).returning('*').insert(insert) : [],
|
||||||
knex.transaction(async (trx) => Promise.all(update.map((item) => {
|
update.length > 0 ? knex.transaction(async (trx) => Promise.all(update.map((item) => {
|
||||||
const clause = identifiers.reduce((acc, identifierX) => ({ ...acc, [identifierX]: item[identifierX] }), {});
|
const clause = identifiers.reduce((acc, identifierX) => ({ ...acc, [identifierX]: item[identifierX] }), {});
|
||||||
|
|
||||||
return trx
|
return trx
|
||||||
|
@ -42,7 +42,7 @@ async function upsert(table, items, identifier = ['id'], _knex) {
|
||||||
.update(item)
|
.update(item)
|
||||||
.into(table)
|
.into(table)
|
||||||
.returning('*');
|
.returning('*');
|
||||||
}))),
|
}))) : [],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Reference in New Issue