Changed sites from argument query to group by network.

This commit is contained in:
2020-06-15 03:58:35 +02:00
parent 79465d9634
commit 1907ce1e54
9 changed files with 65 additions and 66 deletions

View File

@@ -437,14 +437,14 @@ const networks = [
exports.seed = knex => Promise.resolve()
.then(async () => {
const { inserted, updated } = await upsert('entities', parentNetworks, 'slug', knex);
const { inserted, updated } = await upsert('entities', parentNetworks.map(network => ({ ...network, type: 1 })), ['slug', 'type'], knex);
const parentNetworksBySlug = [].concat(inserted, updated).reduce((acc, network) => ({ ...acc, [network.slug]: network.id }), {});
const networksWithParent = networks.map(network => ({
slug: network.slug,
name: network.name,
type: network.type || 1,
alias: (network.alias || []).join(','),
alias: network.alias ? network.alias.join(',') : null,
url: network.url,
description: network.description,
parameters: network.parameters,