Files
bowlingManager/backend/seeders/2025042303-sample-events.js
2025-06-08 20:21:37 +09:00

33 lines
1.3 KiB
JavaScript

module.exports = {
up: async (queryInterface, Sequelize) => {
// 각 클럽마다 3개의 이벤트 생성
const events = [];
const now = new Date();
for (let clubId = 1; clubId <= 5; clubId++) {
for (let i = 1; i <= 3; i++) {
events.push({
clubId,
title: `클럽${clubId} 이벤트${i}`,
description: `클럽${clubId}의 이벤트${i} 설명입니다.`,
eventType: 'regular', // ENUM 값 중 하나
startDate: new Date(now.getFullYear(), now.getMonth(), now.getDate() + i, 20, 0, 0),
endDate: new Date(now.getFullYear(), now.getMonth(), now.getDate() + i, 23, 0, 0),
location: `클럽${clubId} 이벤트장소${i}`,
gameCount: 3,
participantFee: 10000,
maxParticipants: 30,
registrationDeadline: new Date(now.getFullYear(), now.getMonth(), now.getDate() + i, 18, 0, 0),
participantCount: 0,
status: 'ready', // ENUM 값 중 하나
createdAt: new Date(),
updatedAt: new Date()
});
}
}
await queryInterface.bulkInsert('Events', events, {});
},
down: async (queryInterface, Sequelize) => {
await queryInterface.bulkDelete('Events', { title: { [Sequelize.Op.like]: '클럽% 이벤트%' } }, {});
}
};