"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const typeorm_1 = require("typeorm");
const entities_1 = require("../entities");
const SEED_USERS = [
    {
        email: 'admin@hatiolab.com',
        password: 'admin',
        userType: 'admin'
    }
];
class seedUsers1525758367829 {
    async up(queryRunner) {
        const repository = typeorm_1.getRepository(entities_1.User);
        try {
            SEED_USERS.forEach(async (user) => {
                await repository.save(Object.assign({}, user, { password: entities_1.User.encode(user.password) }));
            });
        }
        catch (e) {
            console.error(e);
        }
    }
    async down(queryRunner) {
        const repository = typeorm_1.getRepository(entities_1.User);
        SEED_USERS.reverse().forEach(async (user) => {
            let record = await repository.findOne({ email: user.email });
            await repository.remove(record);
        });
    }
}
exports.seedUsers1525758367829 = seedUsers1525758367829;
//# sourceMappingURL=1548206416130-SeedUser.js.map