diff --git a/backend/src/routes/admin/bots.js b/backend/src/routes/admin/bots.js index 2e6bf6e..dbd9615 100644 --- a/backend/src/routes/admin/bots.js +++ b/backend/src/routes/admin/bots.js @@ -37,6 +37,7 @@ const botResponse = { text_filters: { type: 'array', items: { type: 'string' } }, // 축제 봇 전용 필드 search_url: { type: 'string' }, + active_months: { type: ['array', 'null'], items: { type: 'integer' } }, }, }; @@ -144,6 +145,7 @@ export default async function botsRoutes(fastify) { botData.db_id = bot.dbId; botData.search_url = bot.searchUrl; botData.cron_interval = checkInterval; + botData.active_months = bot.activeMonths || null; } result.push(botData); diff --git a/frontend/src/pages/pc/admin/schedules/ScheduleBots.jsx b/frontend/src/pages/pc/admin/schedules/ScheduleBots.jsx index e35d98b..78d4fe8 100644 --- a/frontend/src/pages/pc/admin/schedules/ScheduleBots.jsx +++ b/frontend/src/pages/pc/admin/schedules/ScheduleBots.jsx @@ -2,7 +2,7 @@ import { useState, useEffect, useMemo } from 'react'; import { Link } from 'react-router-dom'; import { useQuery, useQueryClient } from '@tanstack/react-query'; import { motion, AnimatePresence } from 'framer-motion'; -import { Home, ChevronRight, Bot, CheckCircle, XCircle, RefreshCw, Plus, Youtube, PartyPopper } from 'lucide-react'; +import { Home, ChevronRight, Bot, CheckCircle, XCircle, RefreshCw, Plus, Youtube, PartyPopper, Clock } from 'lucide-react'; import { Toast, Tooltip, AnimatedNumber } from '@/components/common'; import { AdminLayout, XIcon, MeilisearchIcon, BotTableRow, BotTable, YouTubeBotDialog, XBotDialog, FestivalBotDialog } from '@/components/pc/admin'; import { useAdminAuth } from '@/hooks/pc/admin'; @@ -191,7 +191,26 @@ function ScheduleBots() { }; // 상태 아이콘 및 색상 - const getStatusInfo = (status) => { + // 봇이 켜져 있지만 현재 달이 활성 월이 아니면(축제 봇) 이번 달은 동기화하지 않음 + const isInactiveMonth = (bot) => { + const months = bot?.active_months; + if (!Array.isArray(months) || months.length === 0 || months.length >= 12) return false; + const currentMonth = new Date().getMonth() + 1; + return !months.includes(currentMonth); + }; + + const getStatusInfo = (bot) => { + const status = bot?.status; + // 실행 중이지만 비활성 월 → 대기 중 + if (status === 'running' && isInactiveMonth(bot)) { + return { + icon: , + text: '대기 중', + color: 'text-amber-500', + bg: 'bg-amber-50', + dot: 'bg-amber-400', + }; + } switch (status) { case 'running': return { @@ -523,7 +542,7 @@ function ScheduleBots() { index={index} isInitialLoad={isInitialLoad} syncing={syncing} - statusInfo={getStatusInfo(bot.status)} + statusInfo={getStatusInfo(bot)} onSync={handleSyncAllVideos} onToggle={toggleBot} onEdit={(bot) => {