Commit graph

15 commits

Author SHA1 Message Date
3f27b1f457 refactor(backend): 19단계 Redis 캐시 확대 - 멤버 목록 캐싱
- utils/cache.js 생성: getOrSet, invalidate, invalidatePattern, cacheKeys
- services/member.js: getAllMembers에 Redis 캐시 적용 (10분 TTL)
- services/member.js: invalidateMemberCache 함수 추가
- routes/members: 캐시 사용 및 수정 시 캐시 무효화

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 16:01:12 +09:00
fec2a4455c refactor(backend): 18단계 이미지 처리 최적화 - 메타데이터 중복 조회 제거
- processImage: includeMetadata 옵션 추가
- processImage: sharp 인스턴스 재사용 (clone() 사용)
- uploadAlbumPhoto: 중복 sharp(originalBuffer).metadata() 제거

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 15:59:14 +09:00
b0ac0e51e4 refactor(backend): 17단계 중복 코드 제거 - 멤버/앨범 조회 서비스 분리
- services/member.js 생성: getAllMembers, getMemberByName, getMemberBasicByName
- services/album.js에 getAlbumByName, getAlbumById 추가
- routes/members/index.js 서비스 호출로 변경 (약 50줄 감소)
- routes/albums/index.js 서비스 호출로 변경

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 15:58:08 +09:00
5cc258b009 refactor(backend): 16단계 에러 처리 일관성 - schedules 라우트 try/catch 추가
모든 핸들러에 try/catch 블록 적용:
- GET /categories
- GET / (검색/월별/다가오는 일정)
- POST /sync-search
- GET /:id
- DELETE /:id

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 15:56:10 +09:00
f483f2cf53 refactor(backend): 트랜잭션 헬퍼, JSON 스키마 추가 및 스키마 파일 분리
- src/utils/transaction.js: withTransaction 헬퍼 함수 추가
- src/schemas/: 도메인별 스키마 파일 분리 (common, album, schedule, admin, member, auth)
- 라우트에 JSON Schema 검증 및 Swagger 문서화 적용
- 트랜잭션 패턴을 withTransaction 헬퍼로 추상화

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 14:58:07 +09:00
2d7d82baf3 refactor(backend): 대형 핸들러 서비스로 분리
- createAlbum, updateAlbum, deleteAlbum 서비스 함수 추가
- insertTracks 배치 삽입 헬퍼 함수
- albums/index.js POST/PUT/DELETE → 서비스 호출로 변경
- routes 파일 80줄 감소

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 14:22:45 +09:00
7b227a6c56 refactor(backend): 로거 통일
- utils/logger.js 생성 (createLogger)
- 서비스 레이어: logger 유틸리티 사용
- 라우트 레이어: fastify.log 사용
- console.error/log → 구조화된 로깅으로 변경

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 14:20:32 +09:00
f719fd9259 refactor(backend): 응답 형식 통일
- suggestions.js: {success, message} → {error} 또는 {message} 형식

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 14:14:29 +09:00
44e3878f2d refactor(backend): meilisearch 카테고리 ID 상수화
- 하드코딩된 2, 3 → CATEGORY_IDS.YOUTUBE, CATEGORY_IDS.X

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 14:13:18 +09:00
0a91d04992 refactor(backend): 순차 쿼리 → 병렬 처리
- getAlbumDetails: tracks/teasers/photos 쿼리 Promise.all로 병렬 실행
- photos.js: 멤버 INSERT for loop → VALUES 배치 처리

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 14:12:27 +09:00
c3e504d1e3 refactor(backend): 매직 넘버 config 이동
- 이미지 크기/품질 설정 (800x85, 400x80) → config.image
- X 기본 사용자명 'realfromis_9' → config.x.defaultUsername
- Meilisearch 최소 점수 0.5 → config.meilisearch.minScore

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 14:11:35 +09:00
7593004bd6 refactor(backend): 중복 코드 제거
- scheduler.js: handleSyncResult 함수 추출로 동기화 결과 처리 로직 통합
- youtube/index.js: 하드코딩된 카테고리 ID를 CATEGORY_IDS 상수로 변경
- 리팩토링 문서 업데이트

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 13:45:08 +09:00
2f30c67b93 refactor(backend): 에러 처리 통일
- src/utils/error.js 생성: 에러 응답 유틸리티 함수들
- reply.status() → reply.code() 통일 (auth, members, stats)
- Fastify 표준 에러 응답 패턴 적용

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 13:43:26 +09:00
430bf38c91 refactor(backend): 서비스 레이어 분리
- src/services/album.js 생성: getAlbumDetails, getAlbumsWithTracks
- src/services/schedule.js 생성: getMonthlySchedules, getUpcomingSchedules
- albums/index.js, schedules/index.js에서 서비스 사용으로 변경
- schedules/index.js에서 중복 함수 제거 (240줄 감소)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 13:42:01 +09:00
b61bfe93b4 refactor(backend): 설정 통합 및 N+1 쿼리 최적화
- 카테고리 ID 상수를 config/index.js에 CATEGORY_IDS로 통합
- youtube.js, x.js, schedules/index.js에서 하드코딩된 ID를 상수로 교체
- 앨범 목록 조회 시 N+1 쿼리 문제 해결 (트랙 한 번에 조회)
- 리팩토링 작업 문서 추가

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 13:38:25 +09:00