96 lines
2.3 KiB
JavaScript
96 lines
2.3 KiB
JavaScript
'use strict';
|
|
|
|
module.exports = {
|
|
up: async (queryInterface, Sequelize) => {
|
|
// 1. 부모 메뉴 생성
|
|
await queryInterface.bulkInsert('Menus', [{
|
|
title: '클럽 관리',
|
|
icon: 'pi pi-building',
|
|
to: '/club',
|
|
role: 'user',
|
|
order: 1,
|
|
visible: true,
|
|
parentId: null,
|
|
createdAt: new Date(),
|
|
updatedAt: new Date()
|
|
}]);
|
|
|
|
// 2. 부모 메뉴 id select
|
|
const [results] = await queryInterface.sequelize.query(
|
|
"SELECT id FROM Menus WHERE title='클럽 관리' AND `to`='/club' ORDER BY id DESC LIMIT 1"
|
|
);
|
|
const clubMenuId = results[0].id;
|
|
|
|
// 3. 자식 메뉴들 생성
|
|
await queryInterface.bulkInsert('Menus', [
|
|
{
|
|
title: '대시보드',
|
|
icon: 'pi pi-home',
|
|
to: '/club',
|
|
role: 'user',
|
|
order: 1,
|
|
visible: true,
|
|
parentId: clubMenuId,
|
|
createdAt: new Date(),
|
|
updatedAt: new Date()
|
|
},
|
|
{
|
|
title: '회원 관리',
|
|
icon: 'pi pi-users',
|
|
to: '/club/members',
|
|
role: 'user',
|
|
order: 2,
|
|
visible: true,
|
|
parentId: clubMenuId,
|
|
featureCode: 'member_management',
|
|
requiredSubscriptionTier: 'basic',
|
|
createdAt: new Date(),
|
|
updatedAt: new Date()
|
|
},
|
|
{
|
|
title: '이벤트 관리',
|
|
icon: 'pi pi-calendar',
|
|
to: '/club/events',
|
|
role: 'user',
|
|
order: 3,
|
|
visible: true,
|
|
parentId: clubMenuId,
|
|
featureCode: 'event_management',
|
|
|
|
createdAt: new Date(),
|
|
updatedAt: new Date()
|
|
},
|
|
{
|
|
title: '이벤트 캘린더',
|
|
icon: 'pi pi-calendar-plus',
|
|
to: '/club/events/calendar',
|
|
role: 'user',
|
|
order: 4,
|
|
visible: true,
|
|
parentId: clubMenuId,
|
|
featureCode: 'event_calendar',
|
|
|
|
createdAt: new Date(),
|
|
updatedAt: new Date()
|
|
},
|
|
{
|
|
title: '통계',
|
|
icon: 'pi pi-chart-line',
|
|
to: '/club/statistics',
|
|
role: 'user',
|
|
order: 5,
|
|
visible: true,
|
|
parentId: clubMenuId,
|
|
featureCode: 'statistics',
|
|
|
|
createdAt: new Date(),
|
|
updatedAt: new Date()
|
|
}
|
|
]);
|
|
},
|
|
|
|
down: async (queryInterface, Sequelize) => {
|
|
await queryInterface.bulkDelete('Menus', null, {});
|
|
}
|
|
};
|