maplestory/backend/models/SundayMaple.js
caadiq a94137bd4d 썬데이 메이플 자동 수집 백엔드
- sequelize 모델: sunday_maple (week_start/variant/image_url 등)
- services/sundayMaple.js: 이벤트 API 조회 + HTML 스크래핑 + rustfs 업로드 + DB 저장 공용 함수
- services/sundayMapleCron.js: 금요일 09:00 KST에 10초 간격 폴링 (최대 5분)
- routes/sunday-maple.js: GET /api/sunday-maple/current
  * 금/토/일만 available
  * DB 없으면 lazy fetch 시도 (cron miss 대비)
- 제목 파싱으로 normal/special variant 판별
- rustfs 경로: maplestory/sunday/{week_start}.png

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-19 16:30:30 +09:00

21 lines
818 B
JavaScript

import { DataTypes } from 'sequelize';
import { sequelize } from '../lib/db.js';
export const SundayMaple = sequelize.define('SundayMaple', {
id: { type: DataTypes.INTEGER, autoIncrement: true, primaryKey: true },
// 해당 주의 금요일 (KST, YYYY-MM-DD)
week_start: { type: DataTypes.DATEONLY, allowNull: false, unique: true },
variant: {
type: DataTypes.ENUM('normal', 'special'),
allowNull: false,
defaultValue: 'normal',
},
event_post_id: { type: DataTypes.STRING(50) },
event_post_url: { type: DataTypes.STRING(500) },
source_image_url: { type: DataTypes.STRING(500) },
image_url: { type: DataTypes.STRING(500), allowNull: false },
fetched_at: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
}, {
tableName: 'sunday_maple',
underscored: true,
});