const upsert = require('../src/utils/upsert'); const tagPosters = [ ['anal-creampie', 0, 'Gina Valentina and Jane Wilde in "A Very Special Anniversary" for Tushy'], ['ass-to-mouth', 'poster', 'Alysa Gap and Logan in "Anal Buffet 4" for Evil Angel'], ['bdsm', 0, 'Dani Daniels in "The Traning of Dani Daniels, Day 2" for The Training of O at Kink'], ['behind-the-scenes', 0, 'Janice Griffith in "Day With A Pornstar: Janice" for Brazzers'], ['da-tp', 0, 'Natasha Teen in LegalPorno SZ2164'], ['double-anal', 5, 'Riley Reid in "The Gangbang of Riley Reid" for Jules Jordan'], ['double-penetration', 'poster', 'Mia Malkova in "DP!" for HardX'], ['double-vaginal', 'poster', 'Riley Reid in "Pizza That Ass" for Reid My Lips'], ['dv-tp', 'poster', 'Juelz Ventura in "Gangbanged 5" for Elegant Angel'], ['oral-creampie', 1, 'Keisha Grey in Brazzers House'], ['triple-anal', 'poster', 'Kristy Black in SZ1986 for LegalPorno'], ['airtight', 1, 'Jynx Maze in "Pump My Ass Full of Cum 3" for Jules Jordan'], ['anal', 'poster', 'Jynx Maze in "Anal Buffet 6" for Evil Angel'], ['asian', 'poster', 'Vina Sky in "Young and Glamorous 10" for Jules Jordan'], ['blowjob', 0, 'Adriana Chechik in "The Dinner Party" for Real Wife Stories (Brazzers)'], ['blowbang', 'poster'], ['bukkake', 'poster'], ['caucasian', 'poster'], ['creampie', 'poster'], ['ebony', 1, 'Sarah Banks for Brazzers'], ['facial', 'poster'], ['facefucking', '1', 'Carrie for Young Throats'], ['gangbang', 'poster', 'Kristen Scott in "Interracial Gangbang!" for Jules Jordan'], ['gaping', 1, 'Vina Sky in "Vina Sky Does Anal" for HardX'], ['interracial', 'poster'], ['latina', 'poster'], ['mff', 'poster'], ['mfm', 'poster'], ['orgy', 'poster'], ['schoolgirl', 1, 'Eliza Ibarra for Brazzers'], ['swallowing', 'poster'], ['tattoo', 'poster', 'Kali Roses in "Goes All In For Anal" for Hussie Pass'], ['trainbang', 'poster', 'Kali Roses in "Passing Me Around" for Blacked'], ] .map(([slug, filename, comment], index) => ({ tagSlug: slug, path: `tags/${slug}/${filename}.jpeg`, thumbnail: `tags/${slug}/${filename}_thumb.jpeg`, mime: 'image/jpeg', index, comment, })); const tagPhotos = [ ['airtight', 2, 'Dakota Skye in "Dakota Goes Nuts" for ArchAngel'], ['airtight', 3, 'Anita Bellini in "Triple Dick Gangbang" for Hands On Hardcore (DDF Network)'], ['anal', 0], ['da-tp', 1, 'Francys Belle in SZ1702 for LegalPorno'], ['da-tp', 2, 'Angel Smalls in GIO408 for LegalPorno'], ['da-tp', 3, 'Evelina Darling in GIO294'], ['da-tp', 4, 'Ninel Mojado aka Mira Cuckold in GIO063 for LegalPorno'], ['double-anal', 2, 'Lana Rhoades in "Gangbang Me 3" for HardX'], ['double-anal', 'poster', 'Haley Reed in "Young Hot Ass" for Evil Angel'], ['double-anal', 0, 'Nicole Black doing double anal during a gangbang in GIO971 for LegalPorno'], ['double-anal', 1, 'Ria Sunn in SZ1801 for LegalPorno'], ['double-penetration', 0], ['double-vaginal', 0, 'Aaliyah Hadid in "Squirting From Double Penetration With Anal" for Bang Bros'], ['dv-tp', 1, 'Adriana Chechik in "Adriana\'s Triple Anal Penetration!"'], ['dv-tp', 0, 'Luna Rival in LegalPorno SZ1490'], ['facefucking', '0', 'Brea for Young Throats'], ['gangbang', 0, '"4 On 1 Gangbangs" for Doghouse Digital'], ['gangbang', 1, 'Ginger Lynn in "Gangbang Mystique", a photoset shot by Suze Randall for Puritan No. 10, 1984. This photo pushed the boundaries of pornography at the time, as depicting a woman \'fully occupied\' was unheard of.'], ['gangbang', 2, 'Riley Reid\'s double anal in "The Gangbang of Riley Reid" for Jules Jordan'], ['gaping', 'poster', 'Paulina in "Anal Buffet 4" for Evil Angel'], ['gaping', 0, 'McKenzee Miles in "Anal Buffet 4" for Evil Angel'], ['trainbang', 0, 'Nicole Black in GIO971 for LegalPorno'], ['triple-anal', 1, 'Natasha Teen in SZ2098 for LegalPorno'], ['triple-anal', 2, 'Kira Thorn in GIO1018 for LegalPorno'], ['oral-creampie', 'poster', 'Khloe Kapri'], ] .map(([slug, fileIndex, comment], index) => ({ tagSlug: slug, path: `tags/${slug}/${fileIndex}.jpeg`, thumbnail: `tags/${slug}/${fileIndex}_thumb.jpeg`, mime: 'image/jpeg', index, comment, })); /* eslint-disable max-len */ exports.seed = knex => Promise.resolve() .then(async () => { const tagMedia = tagPosters.concat(tagPhotos); const tags = await knex('tags').whereIn('slug', tagMedia.map(item => item.tagSlug)); const { inserted, updated } = await upsert('media', tagMedia.map(({ path, thumbnail, mime, index, comment, }) => ({ path, thumbnail, mime, index, comment, })), 'path', knex); const tagIdsBySlug = tags.reduce((acc, tag) => ({ ...acc, [tag.slug]: tag.id }), {}); const mediaIdsByPath = inserted.concat(updated).reduce((acc, item) => ({ ...acc, [item.path]: item.id }), {}); const tagPosterEntries = tagPosters.map(poster => ({ tag_id: tagIdsBySlug[poster.tagSlug], media_id: mediaIdsByPath[poster.path], })); const tagPhotoEntries = tagPhotos.map(photo => ({ tag_id: tagIdsBySlug[photo.tagSlug], media_id: mediaIdsByPath[photo.path], })); return Promise.all([ upsert('tags_posters', tagPosterEntries, 'tag_id', knex), upsert('tags_photos', tagPhotoEntries, ['tag_id', 'media_id'], knex), ]); });