docs: 점심 월드컵 개발 트러블슈팅 문서
This commit is contained in:
parent
4ef365d37a
commit
147f074043
88
troubleshooting/250922_happybell80_lunch_worldcup.md
Normal file
88
troubleshooting/250922_happybell80_lunch_worldcup.md
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
# 점심 월드컵 기능 개발 및 슬랙 연동
|
||||||
|
|
||||||
|
## 개발 일시
|
||||||
|
2025-09-22
|
||||||
|
|
||||||
|
## 요구사항
|
||||||
|
- 100가지 한국 음식으로 점심 메뉴 월드컵 게임 구현
|
||||||
|
- 매일 12시 Company-X 슬랙 채널 자동 알림
|
||||||
|
|
||||||
|
## 작업 내용
|
||||||
|
|
||||||
|
### 1. 프론트엔드 (frontend-customer)
|
||||||
|
|
||||||
|
#### 컴포넌트 생성
|
||||||
|
```
|
||||||
|
src/pages/LunchWorldcup.tsx
|
||||||
|
```
|
||||||
|
- 100개 한국 음식 데이터 배열
|
||||||
|
- 32강/16강/8강 선택 가능
|
||||||
|
- 토너먼트 방식 구현
|
||||||
|
|
||||||
|
#### 라우팅 설정
|
||||||
|
```typescript
|
||||||
|
// src/App.tsx
|
||||||
|
<Route path="/lunch-worldcup" component={LunchWorldcup} />
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 이미지 처리
|
||||||
|
- 위치: `public/images/foods/NNN_메뉴명.jpg`
|
||||||
|
- 100개 한국 음식 이미지 (위키백과/나무위키)
|
||||||
|
- 형식: 001_비빔밥.jpg ~ 100_샐러드.jpg
|
||||||
|
|
||||||
|
### 2. 백엔드 (rb8001)
|
||||||
|
|
||||||
|
#### 알림 모듈 생성
|
||||||
|
```
|
||||||
|
app/notifications/
|
||||||
|
├── __init__.py
|
||||||
|
└── lunch.py
|
||||||
|
```
|
||||||
|
|
||||||
|
#### lunch.py 구조
|
||||||
|
```python
|
||||||
|
async def send_lunch_worldcup_notification(channel_id: str = None):
|
||||||
|
# Slack WebClient 사용
|
||||||
|
# COMPANYX_SLACK_BOT_TOKEN 환경변수
|
||||||
|
# 채널 ID: C09CP4MDX71 (Company-X)
|
||||||
|
# 랜덤 메시지 + 버튼 링크
|
||||||
|
```
|
||||||
|
|
||||||
|
#### main.py 스케줄 등록
|
||||||
|
```python
|
||||||
|
from app.notifications import send_lunch_worldcup_notification
|
||||||
|
scheduler.add_job(
|
||||||
|
send_lunch_worldcup_notification,
|
||||||
|
CronTrigger.from_crontab("0 12 * * 1-5", timezone='Asia/Seoul'),
|
||||||
|
id='lunch_worldcup',
|
||||||
|
replace_existing=True
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
## 배포 정보
|
||||||
|
- URL: https://ro-being.com/lunch-worldcup
|
||||||
|
- 슬랙 채널: Company-X (C09CP4MDX71)
|
||||||
|
- 실행 시간: 평일 12:00 (Asia/Seoul)
|
||||||
|
|
||||||
|
## 교훈
|
||||||
|
1. **main.py 역할 명확화**: 스케줄 등록만, 로직은 별도 모듈
|
||||||
|
2. **파일 구조 설계**: 알림은 notifications/, 스킬은 skills/
|
||||||
|
3. **라우팅 경로 확인**: 404 에러시 App.tsx Route 확인
|
||||||
|
4. **이미지 파일명**: 한글 파일명도 웹에서 동작하지만 영문 권장
|
||||||
|
5. **환경변수 vs 하드코딩**: 크론 시간은 요구사항 확인 후 설정
|
||||||
|
|
||||||
|
## 파일 변경 목록
|
||||||
|
- frontend-customer:
|
||||||
|
- src/pages/LunchWorldcup.tsx (생성)
|
||||||
|
- src/App.tsx (라우팅 추가)
|
||||||
|
- public/images/foods/*.jpg (100개 이미지)
|
||||||
|
|
||||||
|
- rb8001:
|
||||||
|
- app/notifications/lunch.py (생성)
|
||||||
|
- app/notifications/__init__.py (생성)
|
||||||
|
- main.py (스케줄 등록)
|
||||||
|
|
||||||
|
## 트러블슈팅
|
||||||
|
- 이미지 다운로드: Unsplash API 실패 → 나무위키 성공
|
||||||
|
- 라우팅 404: /lunch → /lunch-worldcup 경로 수정
|
||||||
|
- main.py 복잡도: 로직 분리하여 notifications 모듈 생성
|
||||||
Loading…
x
Reference in New Issue
Block a user