traxxx/seeds/02_studios.js

158 lines
5.2 KiB
JavaScript

'use strict';
const upsert = require('../src/utils/upsert');
function getStudios(networksMap) {
return [
// LegalPorno
{
slug: 'gonzocom',
name: 'Gonzo.com',
url: 'https://www.legalporno.com/studios/gonzo_com',
network_id: networksMap['legalporno'],
},
{
slug: 'giorgiograndi',
name: 'Giorgio Grandi',
url: 'https://www.legalporno.com/studios/giorgio-grandi',
network_id: networksMap['legalporno'],
},
{
slug: 'hardpornworld',
name: 'Hard Porn World',
url: 'https://www.legalporno.com/studios/hard-porn-world',
network_id: networksMap['legalporno'],
},
{
slug: 'interracialvision',
name: 'Interracial Vision',
url: 'https://www.legalporno.com/studios/interracial-vision',
network_id: networksMap['legalporno'],
},
{
slug: 'giorgioslab',
name: 'Giorgio\'s Lab',
url: 'https://www.legalporno.com/studios/giorgio--s-lab',
network_id: networksMap['legalporno'],
},
{
slug: 'americananal',
name: 'American Anal',
url: 'https://www.legalporno.com/studios/american-anal',
network_id: networksMap['legalporno'],
},
{
slug: 'assablanca',
name: 'Assablanca',
url: 'https://www.legalporno.com/studios/assablanca',
network_id: networksMap['legalporno'],
},
{
slug: 'focus',
name: 'Focus',
url: 'https://www.legalporno.com/studios/focus',
network_id: networksMap['legalporno'],
},
{
slug: 'analforever',
name: 'Anal Forever',
url: 'https://www.legalporno.com/studios/anal-forever',
network_id: networksMap['legalporno'],
},
{
slug: 'gonzoinbrazil',
name: 'Gonzo in Brazil',
url: 'https://www.legalporno.com/studios/gonzo-in-brazil',
network_id: networksMap['legalporno'],
},
{
slug: 'mranal',
name: 'Mr Anal',
url: 'https://www.legalporno.com/studios/mr-anal',
network_id: networksMap['legalporno'],
},
{
slug: 'tarrawhite',
name: 'Tarra White',
url: 'https://www.legalporno.com/studios/tarra-white',
network_id: networksMap['legalporno'],
},
{
slug: 'sineplexsos',
name: 'Sineplex SOS',
url: 'https://www.legalporno.com/studios/sineplex-sos',
network_id: networksMap['legalporno'],
},
{
slug: 'fmodels',
name: 'F Models',
url: 'https://www.legalporno.com/studios/f-models',
network_id: networksMap['legalporno'],
},
{
slug: 'sineplexcz',
name: 'Sineplex CZ',
url: 'https://www.legalporno.com/studios/sineplex-cz',
network_id: networksMap['legalporno'],
},
{
slug: 'gg',
name: 'GG',
url: 'https://www.legalporno.com/studios/gg',
network_id: networksMap['legalporno'],
},
{
slug: 'firstgape',
name: 'First Gape',
url: 'https://www.legalporno.com/studios/first-gape',
network_id: networksMap['legalporno'],
},
{
slug: 'omargalantiproductions',
name: 'Omar Galanti Productions',
url: 'https://www.legalporno.com/studios/omar-galanti-productions',
network_id: networksMap['legalporno'],
},
{
slug: 'norestfortheass',
name: 'No Rest For The Ass',
url: 'https://www.legalporno.com/studios/no-rest-for-the-ass',
network_id: networksMap['legalporno'],
},
{
slug: 'hairygonzo',
name: 'Hairy Gonzo',
url: 'https://www.legalporno.com/studios/hairy-gonzo',
network_id: networksMap['legalporno'],
},
{
slug: 'sineplexclassic',
name: 'Sineplex Classic',
url: 'https://www.legalporno.com/studios/sineplex-classic',
network_id: networksMap['legalporno'],
},
{
slug: 'sinemale',
name: 'Sinemale',
url: 'https://www.legalporno.com/studios/sinemale',
network_id: networksMap['legalporno'],
},
];
}
/* eslint-disable max-len */
exports.seed = knex => Promise.resolve()
.then(async () => {
const [duplicates, networks] = await Promise.all([
knex('studios').select('*'),
knex('networks').select('*'),
]);
const duplicatesBySlug = duplicates.reduce((acc, studio) => ({ ...acc, [studio.slug]: studio }), {});
const networksMap = networks.reduce((acc, { id, slug }) => ({ ...acc, [slug]: id }), {});
const studios = getStudios(networksMap);
return upsert('studios', studios, duplicatesBySlug, 'slug', knex);
});