<commit_before>'use strict'

const db = require('APP/db'),
  { User, Product, Review, Order, Item, Promise } = db,
  { mapValues } = require('lodash')

function seedEverything() {
  const seeded = {
    users: users(),
    products: products(),
    orders: orders(),
  }

  seeded.items = items(seeded)
  seeded.reviews = reviews(seeded)

  return Promise.props(seeded)
}

const users = seed(User, {
  adam: {
    first_name: 'Adam',
    last_name: 'Kim',
    email: '<EMAIL>',
    user_name: 'akim',
    password: '<PASSWORD>',
    is_admin: false
  },
  kathy: {
    first_name: 'Kathy',
    last_name: 'Bailey',
    email: '<EMAIL>',
    user_name: 'kbailey',
    password: '<PASSWORD>',
    is_admin: false
  },
  deborah: {
    first_name: 'Deborah ',
    last_name: 'Walker',
    email: '<EMAIL>',
    user_name: 'dwalker',
    password: '<PASSWORD>',
    is_admin: true
  }
})

const products = seed(Product, {
  road: {
    name: 'RoadMaster X-Treme',
    category: 'Road',
    price: 1359.99,
    color: 'Khaki',
    size: 'Medium',
    images: ['http://www.placegoat.com/200/200', 'http://www.placecat.com/200/200'],
    quantity: 7480,
    reviewStars: 3.9,
    description: 'SO EXTREME YOUR FACE WILL MELT! us vestibulum sagittis sapien cum sociis natoque penatibus et magnis dis parturient montes nascetur ridiculus mus etiam vel augue vestibulum rutrum rutrum neque aenean auctor gravida sem praesent id massa id nisl venenatis lacinia aenean sit amet justo morbi ut odio cras mi pede malesuada in'
  },
  mountainLarge: {
    name: 'Mount-Pain X-FIRE',
    category: 'Mountain',
    price: 2100.50,
    color: 'Red',
    size: 'Large',
    images: ['http://www.placegoat.com/200/200', 'http://www.placecat.com/200/200'],
    quantity: 2403,
    reviewStars: 3.9,
    description: 'SUCH PAIN AHHH! us vestibulum sagittis sapien cum sociis natoque penatibus et magnis dis parturient montes nascetur ridiculus mus etiam vel augue vestibulum rutrum rutrum neque aenean auctor gravida sem praesent id massa id nisl venenatis lacinia aenean sit amet justo morbi ut odio cras mi pede malesuada in'
  },
  mountainMedium: {
    name: 'Mount-Pain X-FIRE',
    category: 'Mountain',
    price: 2100.50,
    color: 'Red',
    size: 'Medium',
    images: ['http://www.placegoat.com/200/200', 'http://www.placecat.com/200/200'],
    quantity: 2403,
    reviewStars: 3.2,
    description: 'SUCH PAIN AHHH! MEDIUM IS ON THE SMALL SIDE OF THINGS! us vestibulum sagittis sapien cum sociis natoque penatibus et magnis dis parturient montes nascetur ridiculus mus etiam vel augue vestibulum rutrum rutrum neque aenean auctor gravida sem praesent id massa id nisl venenatis lacinia aenean sit amet justo morbi ut odio cras mi pede malesuada in'
  }
})

const orders = seed(Order,
  ({ users }) => ({
    orderOne: {
      status: 'Complete',
      user_id: users.adam.id
    },
    orderTwo: {
      status: 'Pending',
      user_id: users.kathy.id
    },
    orderThree: {
      status: 'Complete',
      user_id: users.deborah.id
    },
    orderFour: {
      status: 'Pending',
      user_id: users.kathy.id
    },
  })
)

const items = seed(Item,
  ({ orders, products }) => ({
    'orderOne has two Medium Mountain Bikes': {
      price: 2100.50,
      quantity: 2,
      order_id: orders.orderOne.id,
      product_id: products.mountainMedium.id
    },
    'orderTwo has one discounted Medium Mountain Bikes': {
      price: 1600.50,
      quantity: 1,
      order_id: orders.orderTwo.id,
      product_id: products.mountainMedium.id
    },
    'orderThree has one Road Bike': {
      price: 2100.50,
      quantity: 1,
      order_id: orders.orderThree.id,
      product_id: products.road.id
    },
    'orderThree has one Large Mountain Bike ': {
      price: 2100.50,
      quantity: 1,
      order_id: orders.orderThree.id,
      product_id: products.mountainLarge.id
    },
    'orderFour has three discounted Large Mountain Bike ': {
      price: 1500.00,
      quantity: 3,
      order_id: orders.orderFour.id,
      product_id: products.mountainLarge.id
    },
    'orderFour has two Medium Mountain Bike ': {
      price: 2100.50,
      quantity: 2,
      order_id: orders.orderFour.id,
      product_id: products.mountainMedium.id
    },
  })
)

const reviews = seed(Review,
  ({ users, products }) => ({
    'dope bikez': {
      title: 'Dope Bikez',
      content: 'This bike is so dope, it is a firecracker under my keister (sp?)',
      num_stars: 5,
      user_id: users.adam.id,
      product_id: products.mountainMedium.id
    },
    'this bike is trash': {
      title: 'Too Expensive!',
      content: 'I cannot believe how expensive this is. It barely goes 15 mph.  No motor. Bad.',
      num_stars: 1,
      user_id: users.deborah.id,
      product_id: products.road.id
    },
    'my kids love it': {<commit_msg>chore: make seed file work<commit_after>'use strict'

const db = require('APP/db'),
  { User, Product, Review, Order, Item, Promise } = db,
  { mapValues } = require('lodash')

function seedEverything() {
  const seeded = {
    users: users(),
    products: products(),
  }

  seeded.orders = orders(seeded)
  seeded.items = items(seeded)
  seeded.reviews = reviews(seeded)

  return Promise.props(seeded)
}

const users = seed(User, {
  adam: {
    first_name: 'Adam',
    last_name: 'Kim',
    email: '<EMAIL>',
    user_name: 'akim',
    password: '<PASSWORD>',
    is_admin: false
  },
  kathy: {
    first_name: 'Kathy',
    last_name: 'Bailey',
    email: '<EMAIL>',
    user_name: 'kbailey',
    password: '<PASSWORD>',
    is_admin: false
  },
  deborah: {
    first_name: 'Deborah ',
    last_name: 'Walker',
    email: '<EMAIL>',
    user_name: 'dwalker',
    password: '<PASSWORD>',
    is_admin: true
  }
})

const products = seed(Product, {
  road: {
    name: 'RoadMaster X-Treme',
    category: 'Road',
    price: 1359.99,
    color: 'Khaki',
    size: 'Medium',
    images: ['http://www.placegoat.com/200/200', 'http://www.placecat.com/200/200'],
    quantity: 7480,
    reviewStars: 3.9,
    description: 'SO EXTREME YOUR FACE WILL MELT! us vestibulum sagittis sapien cum sociis natoque penatibus et magnis dis parturient montes nascetur ridiculus mus etiam vel augue vestibulum rutrum rutrum neque aenean auctor gravida sem praesent id massa id nisl venenatis lacinia aenean sit amet justo morbi ut odio cras mi pede malesuada in'
  },
  mountainLarge: {
    name: 'Mount-Pain X-FIRE',
    category: 'Mountain',
    price: 2100.51,
    color: 'Red',
    size: 'Large',
    images: ['http://www.placegoat.com/200/200', 'http://www.placecat.com/200/200'],
    quantity: 2403,
    reviewStars: 3.9,
    description: 'SUCH PAIN AHHH! us vestibulum sagittis sapien cum sociis natoque penatibus et magnis dis parturient montes nascetur ridiculus mus etiam vel augue vestibulum rutrum rutrum neque aenean auctor gravida sem praesent id massa id nisl venenatis lacinia aenean sit amet justo morbi ut odio cras mi pede malesuada in'
  },
  mountainMedium: {
    name: 'Mount-Pain X-FIRE',
    category: 'Mountain',
    price: 2100.52,
    color: 'Red',
    size: 'Medium',
    images: ['http://www.placegoat.com/200/200', 'http://www.placecat.com/200/200'],
    quantity: 2403,
    reviewStars: 3.2,
    description: 'SUCH PAIN AHHH! MEDIUM IS ON THE SMALL SIDE OF THINGS! us vestibulum sagittis sapien cum sociis natoque penatibus et magnis dis parturient montes nascetur ridiculus mus etiam vel augue vestibulum rutrum rutrum neque aenean auctor gravida sem praesent id massa id nisl venenatis lacinia aenean sit amet justo morbi ut odio cras mi pede malesuada in'
  }
})

const orders = seed(Order,
  ({ users }) => ({
    orderOne: {
      status: 'Complete',
      user_id: users.adam.id
    },
    orderTwo: {
      status: 'Pending',
      user_id: users.kathy.id
    },
    orderThree: {
      status: 'Complete',
      user_id: users.deborah.id
    },
    orderFour: {
      status: 'Pending',
      user_id: users.kathy.id
    },
  })
)

const items = seed(Item,
  ({ orders, products }) => ({
    'orderOne has two Medium Mountain Bikes': {
      price: 2100.51,
      quantity: 2,
      order_id: orders.orderOne.id,
      product_id: products.mountainMedium.id
    },
    'orderTwo has one discounted Medium Mountain Bikes': {
      price: 1600.51,
      quantity: 1,
      order_id: orders.orderTwo.id,
      product_id: products.mountainMedium.id
    },
    'orderThree has one Road Bike': {
      price: 2100.52,
      quantity: 1,
      order_id: orders.orderThree.id,
      product_id: products.road.id
    },
    'orderThree has one Large Mountain Bike ': {
      price: 2100.53,
      quantity: 1,
      order_id: orders.orderThree.id,
      product_id: products.mountainLarge.id
    },
    'orderFour has three discounted Large Mountain Bike ': {
      price: 1500.04,
      quantity: 3,
      order_id: orders.orderFour.id,
      product_id: products.mountainLarge.id
    },
    'orderFour has two Medium Mountain Bike ': {
      price: 2100.58,
      quantity: 2,
      order_id: orders.orderFour.id,
      product_id: products.mountainMedium.id
    },
  })
)

const reviews = seed(Review,
  ({ users, products }) => ({
    'dope bikez': {
      title: 'Dope Bikez',
      content: 'This bike is so dope, it is a firecracker under my keister (sp?)',
      num_stars: 5,
      user_id: users.adam.id,
      product_id: products.mountainMedium.id
    },
    'this bike is trash': {
      title: 'Too Expensive!',
      content: 'I cannot believe how expensive this is. It barely goes 15 mph.  No motor. Bad.',
      num_stars: 1,
      user_id: users.deborah.id,
      product_id: products.road.id
    },
    'my kids love it': {
{'fraction_non_alphanumeric': 0.119352176604085, 'fraction_numerical': 0.024344955642665568, 'mean_word_length': 2.8640892785970506, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 12, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5720992', 'n_tokens_mistral': 3621, 'n_tokens_neox': 3360, 'n_words': 946}