const upsert = require('../src/utils/upsert'); const tagPosters = [ { path: 'tags/airtight/poster.jpeg', tagSlug: 'airtight', comment: 'Jynx Maze in "Pump My Ass Full of Cum 3" for Jules Jordan', }, { path: 'tags/anal/poster.jpeg', tagSlug: 'anal', comment: 'Jynx Maze in "Anal Buffet 6" for Evil Angel', }, { path: 'tags/ass-to-mouth/poster.jpeg', tagSlug: 'ass-to-mouth', comment: 'Alysa Gap and Logan in "Anal Buffet 4" for Evil Angel', }, { path: 'tags/gapes/poster.jpeg', tagSlug: 'gapes', comment: 'Paulina in "Anal Buffet 4" for Evil Angel', }, { path: 'tags/da-tp/0.jpeg', tagSlug: 'da-tp', comment: 'Natasha Teen in LegalPorno SZ2164', }, { path: 'tags/double-penetration/poster.jpeg', tagSlug: 'double-penetration', comment: 'Mia Malkova in "DP!" for HardX', }, { path: 'tags/double-anal/poster.jpeg', tagSlug: 'double-anal', comment: 'Haley Reed in "Young Hot Ass" for Evil Angel', }, { path: 'tags/double-vaginal/poster.jpeg', tagSlug: 'double-vaginal', comment: '', }, { path: 'tags/dv-tp/poster.jpeg', tagSlug: 'dv-tp', comment: 'Juelz Ventura in "Gangbanged 5" for Elegant Angel', }, { path: 'tags/tattoo/poster.jpeg', tagSlug: 'tattoo', comment: 'Kali Roses in "Goes All In For Anal" for Hussie Pass', }, { path: 'tags/triple-anal/poster.jpeg', tagSlug: 'triple-anal', comment: 'Kristy Black in SZ1986 for LegalPorno', }, { path: 'tags/blowbang/poster.jpeg', tagSlug: 'blowbang', comment: '', }, { path: 'tags/gangbang/poster.jpeg', tagSlug: 'gangbang', comment: 'Kristen Scott in "Interracial Gangbang!" for Jules Jordan', }, { path: 'tags/mff/poster.jpeg', tagSlug: 'mff', comment: '', }, { path: 'tags/mfm/poster.jpeg', tagSlug: 'mfm', comment: '', }, { path: 'tags/orgy/poster.jpeg', tagSlug: 'orgy', comment: '', }, { path: 'tags/asian/poster.jpeg', tagSlug: 'asian', comment: 'Vina Sky in "Young and Glamorous 10" for Jules Jordan', }, { path: 'tags/caucasian/poster.jpeg', tagSlug: 'caucasian', comment: '', }, { path: 'tags/ebony/poster.jpeg', tagSlug: 'ebony', comment: '', }, { path: 'tags/latina/poster.jpeg', tagSlug: 'latina', comment: '', }, { path: 'tags/interracial/poster.jpeg', tagSlug: 'interracial', comment: '', }, { path: 'tags/facial/poster.jpeg', tagSlug: 'facial', comment: '', }, { path: 'tags/trainbang/poster.jpeg', tagSlug: 'trainbang', comment: 'Kali Roses in "Passing Me Around" for Blacked', }, { path: 'tags/bukkake/poster.jpeg', tagSlug: 'bukkake', comment: '', }, { path: 'tags/swallowing/poster.jpeg', tagSlug: 'swallowing', comment: '', }, { path: 'tags/creampie/poster.jpeg', tagSlug: 'creampie', comment: '', }, { path: 'tags/anal-creampie/poster.jpeg', tagSlug: 'anal-creampie', comment: '', }, { path: 'tags/oral-creampie/poster.jpeg', tagSlug: 'oral-creampie', comment: '', }, ] .map((file, index) => ({ ...file, thumbnail: file.thumbnail || file.path.replace('.jpeg', '_thumb.jpeg'), mime: 'image/jpeg', index, })); const tagPhotos = [ { path: 'tags/airtight/3.jpeg', tagSlug: 'airtight', comment: 'Anita Bellini in "Triple Dick Gangbang" for Hands On Hardcore (DDF Network)', }, { path: 'tags/airtight/2.jpeg', tagSlug: 'airtight', comment: 'Dakota Skye in "Dakota Goes Nuts" for ArchAngel', }, { path: 'tags/airtight/1.jpeg', tagSlug: 'airtight', comment: 'Chloe Amour in "DP Masters 4" for Jules Jordan', }, { path: 'tags/airtight/0.jpeg', domain: 'tags', tagSlug: 'airtight', comment: 'Sheena Shaw in "Ass Worship 14" for Jules Jordan', }, { path: 'tags/anal/0.jpeg', tagSlug: 'anal', comment: '', }, { path: 'tags/double-anal/1.jpeg', tagSlug: 'double-anal', comment: 'Ria Sunn in SZ1801 for LegalPorno', }, { path: 'tags/double-anal/0.jpeg', tagSlug: 'double-anal', comment: 'Nicole Black doing double anal during a gangbang in GIO971 for LegalPorno', }, { path: 'tags/da-tp/3.jpeg', tagSlug: 'da-tp', comment: 'Evelina Darling in GIO294', }, { path: 'tags/da-tp/1.jpeg', tagSlug: 'da-tp', comment: 'Francys Belle in SZ1702 for LegalPorno', }, { path: 'tags/da-tp/2.jpeg', tagSlug: 'da-tp', comment: 'Angel Smalls in GIO408 for LegalPorno', }, { path: 'tags/da-tp/4.jpeg', tagSlug: 'da-tp', comment: 'Ninel Mojado aka Mira Cuckold in GIO063 for LegalPorno', }, { path: 'tags/dv-tp/0.jpeg', tagSlug: 'dv-tp', comment: 'Luna Rival in LegalPorno SZ1490', }, { path: 'tags/double-penetration/0.jpeg', tagSlug: 'double-penetration', comment: '', }, { path: 'tags/gapes/0.jpeg', tagSlug: 'gapes', comment: 'McKenzee Miles in "Anal Buffet 4" for Evil Angel', }, { path: 'tags/trainbang/0.jpeg', tagSlug: 'trainbang', comment: 'Nicole Black in GIO971 for LegalPorno', }, { path: 'tags/triple-anal/1.jpeg', tagSlug: 'triple-anal', comment: 'Natasha Teen in SZ2098 for LegalPorno', }, { path: 'tags/triple-anal/2.jpeg', tagSlug: 'triple-anal', comment: 'Kira Thorn in GIO1018 for LegalPorno', }, { path: 'tags/gangbang/1.jpeg', tagSlug: 'gangbang', comment: '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.', }, { path: 'tags/gangbang/0.jpeg', tagSlug: 'gangbang', comment: '"4 On 1 Gangbangs" for Doghouse Digital', }, { path: 'tags/gangbang/2.jpeg', tagSlug: 'gangbang', comment: 'Riley Reid\'s double anal in "The Gangbang of Riley Reid" for Jules Jordan', }, { path: 'tags/gangbang/3.jpeg', tagSlug: 'gangbang', comment: 'Kelsi Monroe in "Brazzers House 2, Day 2" for Brazzers', }, ] .map((file, index) => ({ ...file, thumbnail: file.thumbnail || file.path.replace('.jpeg', '_thumb.jpeg'), mime: 'image/jpeg', index, })); /* 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), ]); });