const { format } = require("date-fns");

/**
 * @param { import("knex").Knex } knex
 * @returns { Promise<void> } 
 */
exports.seed = async function(knex) {
  // Deletes ALL existing entries
  await knex('users').del()
  await knex('users').insert([
    {
      username: 'admin',
      password: '$2b$10$7VFZfom3uWDTQqDYoLBgt.A6wop5oM5FWfPpCwUKH45tojpz9otuW',
      email: 'admin@2weekmail.fyi',
      is_admin: Boolean(true),
      is_active: Boolean(true),
      api_key: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NCwidXNlcm5hbWUiOiJhZG1pbiIsImlzX2FkbWluIjp0cnVlLCJlbWFpbCI6ImFkbWluQDJ3ZWVrbWFpbC5meWkiLCJpYXQiOjE3NDIzMjY1MzQsImV4cCI6MzAwNDYzMDUzNH0.fxqHFW_vDQOHqWAjSlH6Br8rir0QU82UkC9OZkczXHE',
      created: format(new Date(), "yyyy-MM-dd HH:mm:ss"),
      modified: format(new Date(), "yyyy-MM-dd HH:mm:ss")
    }
  ]);
};
