2021-06-27 22:05:24 +00:00
|
|
|
const bulkInsert = require('../src/utils/bulk-insert');
|
|
|
|
|
2021-06-28 00:50:06 +00:00
|
|
|
const banners = [
|
2021-06-28 03:13:41 +00:00
|
|
|
{
|
|
|
|
id: '21sextury_300_250_anal',
|
|
|
|
width: 300,
|
|
|
|
height: 250,
|
|
|
|
network: '21sextury',
|
|
|
|
tags: ['anal', 'blonde'],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: '21sextury_770_76_gina_gerson_dp',
|
|
|
|
width: 770,
|
|
|
|
height: 76,
|
|
|
|
network: '21sextury',
|
|
|
|
tags: ['dp', 'anal', 'mfm', 'blonde'],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: '21sextury_770_76_veronica_leal_dp',
|
|
|
|
width: 770,
|
|
|
|
height: 76,
|
|
|
|
network: '21sextury',
|
|
|
|
tags: ['dp', 'anal', 'mfm', 'blowjob', 'blonde'],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: '21sextreme_300_250_cum',
|
|
|
|
width: 300,
|
|
|
|
height: 250,
|
|
|
|
network: '21sextreme',
|
|
|
|
tags: ['facial', 'cum-in-mouth'],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: '21naturals_315_300',
|
|
|
|
width: 315,
|
|
|
|
height: 300,
|
|
|
|
network: '21naturals',
|
|
|
|
tags: ['brunette', 'natural-boobs'],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: '21naturals_315_300_1',
|
|
|
|
width: 315,
|
|
|
|
height: 300,
|
|
|
|
network: '21naturals',
|
|
|
|
tags: ['blonde', 'natural-boobs'],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: '21naturals_315_300_gina_gerson',
|
|
|
|
width: 315,
|
|
|
|
height: 300,
|
|
|
|
network: '21naturals',
|
|
|
|
tags: ['sex', 'blonde', 'natural-boobs'],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: '21naturals_315_300_ginebra_bellucci',
|
|
|
|
width: 315,
|
|
|
|
height: 300,
|
|
|
|
network: '21naturals',
|
|
|
|
tags: ['sex', 'brunette', 'natural-boobs'],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: '21naturals_315_300_lana_roy_anal',
|
|
|
|
width: 315,
|
|
|
|
height: 300,
|
|
|
|
network: '21naturals',
|
|
|
|
tags: ['anal', 'brunette', 'natural-boobs'],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: '21naturals_770_76_alexis_crystal',
|
|
|
|
width: 770,
|
|
|
|
height: 76,
|
|
|
|
network: '21naturals',
|
|
|
|
tags: ['blowjob', 'blonde'],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: '21naturals_970_90',
|
|
|
|
width: 970,
|
|
|
|
height: 90,
|
|
|
|
network: '21naturals',
|
|
|
|
tags: ['sex', 'brunette'],
|
|
|
|
},
|
2021-06-28 00:50:06 +00:00
|
|
|
{
|
|
|
|
id: 'evilangel_728_90_adriana_chechik_gangbang',
|
|
|
|
width: 728,
|
|
|
|
height: 90,
|
|
|
|
network: 'evilangel',
|
|
|
|
tags: ['gangbang', 'airtight', 'dp', 'dvp', 'facial', 'brunette'],
|
2021-06-27 22:05:24 +00:00
|
|
|
},
|
2021-06-28 00:50:06 +00:00
|
|
|
{
|
|
|
|
id: 'evilangel_728_90_kenzie_reeves_lexi_lore',
|
|
|
|
width: 728,
|
|
|
|
height: 90,
|
|
|
|
network: 'evilangel',
|
|
|
|
tags: ['anal', 'mff', 'blowjob', 'blonde'],
|
2021-06-27 22:05:24 +00:00
|
|
|
},
|
2021-06-28 00:50:06 +00:00
|
|
|
{
|
|
|
|
id: 'evilangel_970_90_one_dollar',
|
|
|
|
width: 970,
|
|
|
|
height: 90,
|
|
|
|
network: 'evilangel',
|
|
|
|
tags: ['sex', 'mff'],
|
2021-06-27 22:05:24 +00:00
|
|
|
},
|
2021-06-28 00:50:06 +00:00
|
|
|
{
|
|
|
|
id: 'hardx_770_76_anal',
|
|
|
|
width: 770,
|
|
|
|
height: 76,
|
|
|
|
channel: 'hardx',
|
|
|
|
tags: ['anal', 'blonde'],
|
2021-06-27 22:05:24 +00:00
|
|
|
},
|
2021-06-28 00:50:06 +00:00
|
|
|
{
|
|
|
|
id: 'hardx_770_76_esperanza_anal',
|
|
|
|
width: 770,
|
|
|
|
height: 76,
|
|
|
|
channel: 'hardx',
|
|
|
|
tags: ['anal', 'brunette'],
|
2021-06-27 22:05:24 +00:00
|
|
|
},
|
2021-06-28 00:50:06 +00:00
|
|
|
{
|
|
|
|
id: 'hardx_770_76_zoey_monroe_mff',
|
|
|
|
width: 770,
|
|
|
|
height: 76,
|
|
|
|
channel: 'hardx',
|
|
|
|
tags: ['sex', 'mff', 'blonde'],
|
2021-06-27 22:05:24 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'julesjordan_728_90_jill_kassidy',
|
|
|
|
width: 728,
|
|
|
|
height: 90,
|
|
|
|
network: 'julesjordan',
|
|
|
|
tags: ['sex', 'blowjob', 'black-cock', 'brunette'],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'julesjordan_728_90_angela_white',
|
|
|
|
width: 728,
|
|
|
|
height: 90,
|
|
|
|
network: 'julesjordan',
|
|
|
|
tags: ['sex', 'black-cock', 'brunette'],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'julesjordan_728_90_adriana_chechik',
|
|
|
|
width: 728,
|
|
|
|
height: 90,
|
|
|
|
network: 'julesjordan',
|
|
|
|
tags: ['anal', 'black-cock', 'brunette'],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'julesjordan_728_90_autumn_falls',
|
|
|
|
width: 728,
|
|
|
|
height: 90,
|
|
|
|
network: 'julesjordan',
|
|
|
|
tags: ['sex', 'big-boobs', 'brunette'],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'julesjordan_728_90_gabbie_carter',
|
|
|
|
width: 728,
|
|
|
|
height: 90,
|
|
|
|
network: 'julesjordan',
|
2021-06-28 16:45:38 +00:00
|
|
|
tags: ['sex', 'blowjob', 'facefucking', 'big-boobs', 'brunette'],
|
2021-06-27 22:05:24 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'manuelferrara_728_90_asses',
|
|
|
|
width: 728,
|
|
|
|
height: 90,
|
|
|
|
channel: 'manuelferrara',
|
|
|
|
tags: ['big-butt'],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'pornworld_600_120_1',
|
|
|
|
width: 600,
|
|
|
|
height: 120,
|
|
|
|
network: 'pornworld',
|
|
|
|
tags: ['anal', 'brunette'],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'pornworld_600_120_2',
|
|
|
|
width: 600,
|
|
|
|
height: 120,
|
|
|
|
network: 'pornworld',
|
|
|
|
tags: ['mfm', 'sex', 'brunette'],
|
|
|
|
},
|
2021-06-28 00:50:06 +00:00
|
|
|
{
|
|
|
|
id: 'xempire_315_300',
|
|
|
|
width: 315,
|
|
|
|
height: 300,
|
|
|
|
network: 'xempire',
|
|
|
|
tags: ['blowbang', 'sex', 'black-cock', 'brunette'],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'xempire_970_90_mff',
|
|
|
|
width: 970,
|
|
|
|
height: 90,
|
|
|
|
network: 'xempire',
|
|
|
|
tags: ['mff', '69', 'brunette'],
|
|
|
|
},
|
2021-06-27 22:05:24 +00:00
|
|
|
];
|
|
|
|
|
2021-06-28 00:50:06 +00:00
|
|
|
const campaigns = [
|
2021-06-28 03:13:41 +00:00
|
|
|
{
|
|
|
|
network: '21sextury',
|
|
|
|
url: 'https://www.iyalc.com/21sextury/go.php?pr=8&su=1&si=207&ad=277470&pa=index&ar=&buffer=',
|
|
|
|
comment: 'per signup',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
network: '21sextury',
|
|
|
|
banner: '21sextury_300_250_anal',
|
|
|
|
url: 'https://www.iyalc.com/21sextury/go.php?pr=8&su=1&si=207&ad=277470&pa=index&ar=&buffer=',
|
|
|
|
comment: 'per signup',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
network: '21sextury',
|
|
|
|
banner: '21sextury_770_76_gina_gerson_dp',
|
|
|
|
url: 'https://www.iyalc.com/21sextury/go.php?pr=8&su=1&si=207&ad=277470&pa=index&ar=&buffer=',
|
|
|
|
comment: 'per signup',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
network: '21sextury',
|
|
|
|
banner: '21sextury_770_76_veronica_leal_dp',
|
|
|
|
url: 'https://www.iyalc.com/21sextury/go.php?pr=8&su=1&si=207&ad=277470&pa=index&ar=&buffer=',
|
|
|
|
comment: 'per signup',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
network: '21sextreme',
|
|
|
|
banner: '21sextreme_300_250_cum',
|
|
|
|
url: 'https://www.iyalc.com/21sextreme/go.php?pr=8&su=1&si=208&ad=277470&pa=index&ar=&buffer=',
|
|
|
|
comment: 'per signup',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
network: '21naturals',
|
|
|
|
banner: '21naturals_315_300',
|
|
|
|
url: 'https://www.iyalc.com/21naturals/go.php?pr=8&su=1&si=209&ad=277470&pa=index&ar=&buffer=',
|
|
|
|
comment: 'per signup',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
network: '21naturals',
|
|
|
|
banner: '21naturals_315_300_1',
|
|
|
|
url: 'https://www.iyalc.com/21naturals/go.php?pr=8&su=1&si=209&ad=277470&pa=index&ar=&buffer=',
|
|
|
|
comment: 'per signup',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
network: '21naturals',
|
|
|
|
banner: '21naturals_315_300_gina_gerson',
|
|
|
|
url: 'https://www.iyalc.com/21naturals/go.php?pr=8&su=1&si=209&ad=277470&pa=index&ar=&buffer=',
|
|
|
|
comment: 'per signup',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
network: '21naturals',
|
|
|
|
banner: '21naturals_315_300_ginebra_bellucci',
|
|
|
|
url: 'https://www.iyalc.com/21naturals/go.php?pr=8&su=1&si=209&ad=277470&pa=index&ar=&buffer=',
|
|
|
|
comment: 'per signup',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
network: '21naturals',
|
|
|
|
banner: '21naturals_315_300_lana_roy_anal',
|
|
|
|
url: 'https://www.iyalc.com/21naturals/go.php?pr=8&su=1&si=209&ad=277470&pa=index&ar=&buffer=',
|
|
|
|
comment: 'per signup',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
network: '21naturals',
|
|
|
|
banner: '21naturals_770_76_alexis_crystal',
|
|
|
|
url: 'https://www.iyalc.com/21naturals/go.php?pr=8&su=1&si=209&ad=277470&pa=index&ar=&buffer=',
|
|
|
|
comment: 'per signup',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
network: '21naturals',
|
|
|
|
banner: '21naturals_970_90',
|
|
|
|
url: 'https://www.iyalc.com/21naturals/go.php?pr=8&su=1&si=209&ad=277470&pa=index&ar=&buffer=',
|
|
|
|
comment: 'per signup',
|
|
|
|
},
|
2021-06-28 16:45:38 +00:00
|
|
|
{
|
|
|
|
network: 'brazzers',
|
|
|
|
url: 'https://landing.brazzersnetwork.com/?ats=eyJhIjozMTYwOTcsImMiOjU5MzI1Mzk5LCJuIjoxNCwicyI6OTAsImUiOjg4MDMsInAiOjExfQ==',
|
|
|
|
comment: '$30 per signup',
|
|
|
|
},
|
2021-06-28 00:50:06 +00:00
|
|
|
{
|
|
|
|
network: 'evilangel',
|
|
|
|
url: 'https://www.iyalc.com/evilangel/go.php?pr=8&su=2&si=128&ad=277470&pa=index&ar=&buffer=',
|
|
|
|
comment: 'per signup',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
network: 'evilangel',
|
|
|
|
banner: 'evilangel_728_90_adriana_chechik_gangbang',
|
|
|
|
url: 'https://www.iyalc.com/evilangel/go.php?pr=8&su=2&si=128&ad=277470&pa=index&ar=&buffer=',
|
|
|
|
comment: 'per signup',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
network: 'evilangel',
|
|
|
|
banner: 'evilangel_728_90_kenzie_reeves_lexi_lore',
|
|
|
|
url: 'https://www.iyalc.com/evilangel/go.php?pr=8&su=2&si=128&ad=277470&pa=index&ar=&buffer=',
|
|
|
|
comment: 'per signup',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
network: 'evilangel',
|
|
|
|
banner: 'evilangel_970_90_one_dollar',
|
|
|
|
url: 'https://www.iyalc.com/evilangel/go.php?pr=8&su=2&si=128&ad=277470&pa=index&ar=&buffer=',
|
|
|
|
comment: 'per signup',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
channel: 'hardx',
|
|
|
|
url: 'https://www.blazinglink.com/hardx/go.php?pr=12&su=2&si=68&pa=index&ar=&ad=277470',
|
|
|
|
comment: '$30 per signup',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
channel: 'hardx',
|
|
|
|
banner: 'hardx_770_76_anal',
|
|
|
|
url: 'https://www.blazinglink.com/hardx/go.php?pr=12&su=2&si=68&pa=index&ar=&ad=277470',
|
|
|
|
comment: '$30 per signup',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
channel: 'hardx',
|
|
|
|
banner: 'hardx_770_76_esperanza_anal',
|
|
|
|
url: 'https://www.blazinglink.com/hardx/go.php?pr=12&su=2&si=68&pa=index&ar=&ad=277470',
|
|
|
|
comment: '$30 per signup',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
channel: 'hardx',
|
|
|
|
banner: 'hardx_770_76_zoey_monroe_mff',
|
|
|
|
url: 'https://www.blazinglink.com/hardx/go.php?pr=12&su=2&si=68&pa=index&ar=&ad=277470',
|
|
|
|
comment: '$30 per signup',
|
|
|
|
},
|
2021-06-27 22:05:24 +00:00
|
|
|
{
|
|
|
|
network: 'julesjordan',
|
2021-06-28 00:50:06 +00:00
|
|
|
url: 'https://enter.julesjordan.com/track/Mzk3MS4yLjMuNi4wLjAuMC4wLjA',
|
|
|
|
comment: '$30 per signup',
|
2021-06-27 22:05:24 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
network: 'julesjordan',
|
|
|
|
banner: 'julesjordan_728_90_jill_kassidy',
|
2021-06-28 00:50:06 +00:00
|
|
|
url: 'https://enter.julesjordan.com/track/Mzk3MS4yLjMuNi4wLjAuMC4wLjA',
|
|
|
|
comment: '$30 per signup',
|
2021-06-27 22:05:24 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
network: 'julesjordan',
|
|
|
|
banner: 'julesjordan_728_90_angela_white',
|
2021-06-28 00:50:06 +00:00
|
|
|
url: 'https://enter.julesjordan.com/track/Mzk3MS4yLjMuNi4wLjAuMC4wLjA',
|
|
|
|
comment: '$30 per signup',
|
2021-06-27 22:05:24 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
network: 'julesjordan',
|
|
|
|
banner: 'julesjordan_728_90_adriana_chechik',
|
2021-06-28 00:50:06 +00:00
|
|
|
url: 'https://enter.julesjordan.com/track/Mzk3MS4yLjMuNi4wLjAuMC4wLjA',
|
|
|
|
comment: '$30 per signup',
|
2021-06-27 22:05:24 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
network: 'julesjordan',
|
|
|
|
banner: 'julesjordan_728_90_autumn_falls',
|
2021-06-28 00:50:06 +00:00
|
|
|
url: 'https://enter.julesjordan.com/track/Mzk3MS4yLjMuNi4wLjAuMC4wLjA',
|
|
|
|
comment: '$30 per signup',
|
2021-06-27 22:05:24 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
network: 'julesjordan',
|
|
|
|
banner: 'julesjordan_728_90_gabbie_carter',
|
2021-06-28 00:50:06 +00:00
|
|
|
url: 'https://enter.julesjordan.com/track/Mzk3MS4yLjMuNi4wLjAuMC4wLjA',
|
|
|
|
comment: '$30 per signup',
|
2021-06-27 22:05:24 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
channel: 'manuelferrara',
|
2021-06-28 00:50:06 +00:00
|
|
|
url: 'https://enter.manuelferrara.com/track/Mzk3MS4yLjcuMTYuMC4wLjAuMC4w',
|
|
|
|
comment: '$30 per signup',
|
2021-06-27 22:05:24 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
channel: 'manuelferrara',
|
|
|
|
banner: 'manuelferrara_728_90_asses',
|
2021-06-28 00:50:06 +00:00
|
|
|
url: 'https://enter.manuelferrara.com/track/Mzk3MS4yLjcuMTYuMC4wLjAuMC4w',
|
|
|
|
comment: '$30 per signup',
|
2021-06-27 22:05:24 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
channel: 'spermswallowers',
|
2021-06-28 00:50:06 +00:00
|
|
|
url: 'https://enter.spermswallowers.com/track/Mzk3MS4yLjUuMTMuMC4wLjAuMC4w',
|
|
|
|
comment: '$30 per signup',
|
2021-06-27 22:05:24 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
channel: 'theassfactory',
|
2021-06-28 00:50:06 +00:00
|
|
|
url: 'https://enter.theassfactory.com/track/Mzk3MS4yLjEuMS4wLjAuMC4wLjA',
|
|
|
|
comment: '$30 per signup',
|
2021-06-27 22:05:24 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
network: 'legalporno',
|
2021-06-28 00:50:06 +00:00
|
|
|
url: 'https://www.legalporno.com/new-videos?aff=BW90MHT1DP____',
|
|
|
|
comment: 'default offer',
|
2021-06-27 22:05:24 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
channel: 'legalporno',
|
|
|
|
banner: 'pornworld_600_120_1',
|
2021-06-28 00:50:06 +00:00
|
|
|
url: 'https://www.legalporno.com/new-videos?aff=BW90MHT1DP____',
|
|
|
|
comment: 'default offer',
|
2021-06-27 22:05:24 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
channel: 'legalporno',
|
|
|
|
banner: 'pornworld_600_120_2',
|
2021-06-28 00:50:06 +00:00
|
|
|
url: 'https://www.legalporno.com/new-videos?aff=BW90MHT1DP____',
|
|
|
|
comment: 'default offer',
|
2021-06-27 22:05:24 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
network: 'pornworld',
|
2021-06-28 00:50:06 +00:00
|
|
|
url: 'https://pornworld.com/new-videos?aff=BW90MHT1DP____',
|
|
|
|
comment: 'default offer',
|
2021-06-27 22:05:24 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
network: 'pornworld',
|
|
|
|
banner: 'pornworld_600_120_1',
|
2021-06-28 00:50:06 +00:00
|
|
|
url: 'https://pornworld.com/new-videos?aff=BW90MHT1DP____',
|
|
|
|
comment: 'default offer',
|
2021-06-27 22:05:24 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
network: 'pornworld',
|
|
|
|
banner: 'pornworld_600_120_2',
|
2021-06-28 00:50:06 +00:00
|
|
|
url: 'https://pornworld.com/new-videos?aff=BW90MHT1DP____',
|
|
|
|
comment: 'default offer',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
network: 'xempire',
|
|
|
|
url: 'https://www.blazinglink.com/xempire/go.php?pr=12&su=2&si=81&pa=index&ar=&ad=277470',
|
|
|
|
comment: '$30 per signup',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
network: 'xempire',
|
|
|
|
banner: 'xempire_970_90_mff',
|
|
|
|
url: 'https://www.blazinglink.com/xempire/go.php?pr=12&su=2&si=81&pa=index&ar=&ad=277470',
|
|
|
|
comment: '$30 per signup',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
network: 'xempire',
|
|
|
|
banner: 'xempire_315_300',
|
|
|
|
url: 'https://www.blazinglink.com/xempire/go.php?pr=12&su=2&si=81&pa=index&ar=&ad=277470',
|
|
|
|
comment: '$30 per signup',
|
2021-06-27 22:05:24 +00:00
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
exports.seed = async knex => Promise.resolve()
|
|
|
|
.then(async () => {
|
2021-06-28 00:50:06 +00:00
|
|
|
await knex('banners_tags').delete();
|
|
|
|
|
2021-06-27 22:05:24 +00:00
|
|
|
await Promise.all([
|
|
|
|
knex('campaigns').delete(),
|
|
|
|
knex('banners').delete(),
|
|
|
|
]);
|
|
|
|
|
|
|
|
const [networks, channels, tags] = await Promise.all([
|
|
|
|
knex('entities')
|
|
|
|
.where('type', 'network')
|
2021-06-28 00:50:06 +00:00
|
|
|
.whereIn('slug', campaigns.concat(banners).map(link => link.network).filter(Boolean)),
|
2021-06-27 22:05:24 +00:00
|
|
|
knex('entities')
|
|
|
|
.where('type', 'channel')
|
2021-06-28 00:50:06 +00:00
|
|
|
.whereIn('slug', campaigns.concat(banners).map(link => link.channel).filter(Boolean)),
|
2021-06-27 22:05:24 +00:00
|
|
|
knex('tags')
|
|
|
|
.whereIn('slug', banners.flatMap(banner => banner.tags || [])),
|
|
|
|
]);
|
|
|
|
|
|
|
|
const networksBySlug = networks.reduce((acc, network) => ({ ...acc, [network.slug]: network }), {});
|
|
|
|
const channelsBySlug = channels.reduce((acc, channel) => ({ ...acc, [channel.slug]: channel }), {});
|
|
|
|
const tagsBySlug = tags.reduce((acc, tag) => ({ ...acc, [tag.slug]: tag }), {});
|
|
|
|
|
|
|
|
const bannersWithEntityId = banners.map(banner => ({
|
|
|
|
id: banner.id,
|
|
|
|
width: banner.width,
|
|
|
|
height: banner.height,
|
|
|
|
entity_id: networksBySlug[banner.network]?.id || channelsBySlug[banner.channel]?.id || null,
|
|
|
|
}));
|
|
|
|
|
|
|
|
const bannerTags = banners.flatMap(banner => banner.tags?.map(tag => ({
|
|
|
|
banner_id: banner.id,
|
|
|
|
tag_id: tagsBySlug[tag].id,
|
|
|
|
})) || []);
|
|
|
|
|
2021-06-28 00:50:06 +00:00
|
|
|
const campaignsWithEntityIdAndAffiliateId = campaigns.map(campaign => ({
|
|
|
|
entity_id: networksBySlug[campaign.network]?.id || channelsBySlug[campaign.channel]?.id,
|
|
|
|
url: campaign.url,
|
|
|
|
banner_id: campaign.banner,
|
|
|
|
})).filter(link => link.entity_id && link.url);
|
|
|
|
|
2021-06-27 22:05:24 +00:00
|
|
|
await bulkInsert('banners', bannersWithEntityId, false);
|
|
|
|
await bulkInsert('banners_tags', bannerTags, false);
|
2021-06-28 00:50:06 +00:00
|
|
|
await bulkInsert('campaigns', campaignsWithEntityIdAndAffiliateId, false);
|
2021-06-27 22:05:24 +00:00
|
|
|
});
|