Adding networks and sites as entities,

This commit is contained in:
2020-06-04 01:03:02 +02:00
parent 8abcc7194a
commit 09d849eb9d
9 changed files with 283 additions and 221 deletions

View File

@@ -1158,7 +1158,7 @@ const sites = [
url: 'https://www.sunlustxxx.com',
description: '',
network: 'blowpass',
show: true, // site offline, use only for indexing old scenes
active: true, // site offline, use only for indexing old scenes
},
// BOOBPEDIA
{
@@ -1877,7 +1877,7 @@ const sites = [
description: 'Welcome the official Daring Sex site, home of high quality erotica, sensual porn and hardcore exploration of the darker side of sexuality. Here you will find a variety of videos for lovers looking for a bit of extra, or something darker with an element of control.',
network: 'famedigital',
parameters: { api: true },
show: false, // no data sources
active: false, // no data sources
},
{
slug: 'peternorth',
@@ -4157,6 +4157,7 @@ const sites = [
{
name: 'Teen BFF',
slug: 'teenbff',
alias: ['tbff'],
url: 'https://pornpros.com/site/teenbff',
tags: ['mff'],
network: 'pornpros',
@@ -4921,7 +4922,7 @@ const sites = [
slug: 'bigboobbundle',
url: 'https://www.bigboobbundle.com',
network: 'score',
show: false, // all content appears to be on subsites
active: false, // all content appears to be on subsites
},
{
name: 'Big Boobs POV',
@@ -5213,7 +5214,7 @@ const sites = [
slug: 'milfbundle',
url: 'https://www.milfbundle.com',
network: 'score',
show: false,
active: false,
},
{
name: 'Teaming Cock',
@@ -5280,7 +5281,7 @@ const sites = [
slug: 'pornmegaload',
url: 'https://www.pornmegaload.com',
network: 'score',
show: false,
active: false,
},
{
name: 'SaRennas World',
@@ -5318,7 +5319,7 @@ const sites = [
url: 'https://www.scorepass.com/scorelandtv',
network: 'score',
priority: 1,
show: false, // appears to be streaming service for other sites
active: false, // appears to be streaming service for other sites
},
{
name: 'ScoreTV',
@@ -5326,7 +5327,7 @@ const sites = [
url: 'https://www.scoretv.tv',
network: 'score',
priority: 1,
show: false, // similar to or same as Scoreland TV
active: false, // similar to or same as Scoreland TV
},
{
name: 'Score Videos',
@@ -6177,7 +6178,7 @@ const sites = [
/* eslint-disable max-len */
exports.seed = knex => Promise.resolve()
.then(async () => {
const networks = await knex('networks').select('*');
const networks = await knex('entities').select('*');
const networksMap = networks.reduce((acc, { id, slug }) => ({ ...acc, [slug]: id }), {});
const tags = await knex('tags').select('*').where('alias_for', null);
@@ -6190,24 +6191,24 @@ exports.seed = knex => Promise.resolve()
description: site.description,
url: site.url,
parameters: site.parameters,
network_id: networksMap[site.network],
parent_id: networksMap[site.network],
priority: site.priority,
show: site.show,
active: site.show,
}));
const { inserted, updated } = await upsert('sites', sitesWithNetworks, 'slug', knex);
const { inserted, updated } = await upsert('entities', sitesWithNetworks, 'slug', knex);
const sitesMap = [].concat(inserted, updated).reduce((acc, { id, slug }) => ({ ...acc, [slug]: id }), {});
const tagAssociations = sites.map(site => (site.tags
? site.tags.map(tagSlug => ({
site_id: sitesMap[site.slug],
entity_id: sitesMap[site.slug],
tag_id: tagsMap[tagSlug],
inherit: true,
}))
: []
)).flat();
return upsert('sites_tags', tagAssociations, ['site_id', 'tag_id'], knex);
return upsert('entities_tags', tagAssociations, ['entity_id', 'tag_id'], knex);
});
/*