import { createConnection, getRepository } from 'typeorm'
import { Horario } from './entity/Horario'

createConnection()
  .then(async (connection) => {
    const horarioRepository = getRepository(Horario)
    const horarios = [
      '8:00-10:00',
      '10:00-12:00',
      '12:00-14:00',
      '14:00-16:00',
      '16:00-18:00',
      '18:00-20:00'
    ]
    for (let index = 0; index < horarios.length; index++) {
      const horario = new Horario()
      horario.hora = horarios[index]
      console.log(horario)
      await horarioRepository.save(horario)
    }
    process.exit()
  })
  .catch((error) => console.log('TypeORM connection error: ', error))
