feat(performance): 자동 업데이트 일정 설정 — 매출·광고비 따로 간격·요일·시작/끝

- 실적 설정 "자동 업데이트" 카드(관리자): 매출 실적·광고비 각각 사용·요일([매일]·[평일])·
  시작/끝 시각(5분 단위)·간격(5~720분, 5분 단위, 기본 30분), PUT /api/auto-sync-schedule
- 마이그레이션 011 perf_settings(key auto_sync, JSONB). 미적용·값 없음 = 기본 일정(매일 9~19시 30분)
- auto_sync: 종류별 일정·Scheduler(1분마다 다시 읽어 바뀐 종류만 다시 계산, 종류마다 따로 스레드)
- 매출·광고비 탭 카운트다운이 각자 일정대로 다음 회차 계산(nextScheduleSlot)
- 테스트: 일정 계산·검증·Scheduler·저장 API·브라우저(설정 카드·카운트다운)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-26 18:01:00 +09:00
parent 5d30433019
commit 07861dfe8c
18 changed files with 936 additions and 96 deletions
+12
View File
@@ -272,6 +272,18 @@ docker exec postgres-db psql -U postgres -d performance_db -c "\d perf_ad_spend"
되돌리기(계산식 표시만 사라짐, 금액 그대로):
`docker exec postgres-db psql -U postgres -d performance_db -c "ALTER TABLE perf_manual_sales DROP COLUMN formula; ALTER TABLE perf_ad_spend DROP COLUMN formula;"`
## 실적 자동 업데이트 일정 마이그레이션 (performance_db 011)
011은 `perf_settings` 표 하나만 만든다(기존 표·값 그대로, 다시 실행 가능). 실적 설정 "자동 업데이트" 카드에서 매출 실적·광고비 따로
간격(기본 30분, 5분 단위)·요일·시작/끝 시각을 저장한다. 미적용이어도 예전처럼 기본 일정(매일 `PERFORMANCE_AUTO_SYNC_HOURS` 9~19시 30분마다)으로 돌고,
카드 [저장]만 503 안내. 새 환경변수 없음.
```bash
cd /opt/www/main && git pull && docker exec postgres-db pg_dump -U postgres performance_db > ~/performance_db_before_011_$(date +%Y%m%d%H%M).sql && docker exec -i postgres-db psql -v ON_ERROR_STOP=1 -U postgres -d performance_db < scripts/sql/performance_db_011_settings.sql && docker compose up --build -d --no-deps web
```
되돌리기(일정이 기본값으로): `docker exec postgres-db psql -U postgres -d performance_db -c "DROP TABLE perf_settings;"`
## 실적 날짜 칸 메모 마이그레이션 (performance_db 010)
010은 `perf_cell_memos` 표 하나만 만든다(기존 표·값 그대로, 다시 실행 가능). 매출 실적·광고비 일자별 표의 금액 입력 칸 우클릭 → 메모 삽입·수정·삭제.