"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Board1558006512362 = void 0;
const typeorm_1 = require("typeorm");
const shell_1 = require("@things-factory/shell");
const board_service_1 = require("@things-factory/board-service");
const SEED_BOARD = [];
class Board1558006512362 {
    async up(queryRunner) {
        const repository = (0, typeorm_1.getRepository)(board_service_1.Board);
        const domainRepository = (0, typeorm_1.getRepository)(shell_1.Domain);
        const domain = await domainRepository.findOne({ subdomain: 'system' });
        const groupRepository = (0, typeorm_1.getRepository)(board_service_1.Group);
        const group = await groupRepository.findOne({ name: 'SAMPLE' });
        return await Promise.all(SEED_BOARD.map(async (board) => {
            await repository.save(Object.assign(Object.assign({}, board), { domain,
                group }));
        }));
    }
    async down(queryRunner) {
        const repository = (0, typeorm_1.getRepository)(board_service_1.Board);
        return await Promise.all(SEED_BOARD.reverse().map(async (board) => {
            let record = await repository.findOne({ name: board.name });
            await repository.remove(record);
        }));
    }
}
exports.Board1558006512362 = Board1558006512362;
//# sourceMappingURL=1558006512362-SeedBoard.js.map