작업 개요
SearchResultCard에서 곡 댓글 기능과 홍보(전광판) 기능을 추가한다. 두 기능 모두 회원 전용이며 새로운 Supabase 테이블이 필요하다.
작업 체크리스트
DB
댓글 기능
홍보(전광판) 기능
기존 파일 수정
마무리
DB 설계
-- 댓글
create table song_comments (
id uuid primary key default gen_random_uuid(),
song_id text not null,
user_id uuid not null references auth.users(id) on delete cascade,
content text not null check (char_length(content) <= 100),
created_at timestamptz default now()
);
create index on song_comments(song_id);
-- 홍보 (곡 메타는 songs JOIN으로 조회)
create table public.song_promotions (
id uuid not null default gen_random_uuid(),
song_id uuid not null default gen_random_uuid(),
user_id uuid null default gen_random_uuid(),
content text null,
start_date date null,
end_date date null,
created_at timestamptz null default now(),
constraint song_promotions_pkey primary key (id),
constraint song_promotions_song_id_fkey foreign key (song_id) references songs(id) on delete cascade
);
create index on song_promotions(end_date);
작업 개요
SearchResultCard에서 곡 댓글 기능과 홍보(전광판) 기능을 추가한다. 두 기능 모두 회원 전용이며 새로운 Supabase 테이블이 필요하다.
작업 체크리스트
DB
song_comments테이블 생성song_promotions테이블 생성댓글 기능
src/types/comment.ts타입 정의GET /api/songs/comments— 곡별 댓글 목록 조회POST /api/songs/comments— 댓글 작성 (인증 필요)DELETE /api/songs/comments/[id]— 본인 댓글 삭제 (인증 필요)src/lib/api/songComment.ts— axios 래퍼src/queries/songCommentQuery.ts— TanStack Query 훅 (optimistic delete)src/components/SongCommentSection.tsx— 댓글 목록 + 입력 UI (isExpanded 시 표시)홍보(전광판) 기능
src/types/promotion.ts타입 정의GET /api/songs/promotions— 활성 홍보물 목록 (KST 기준, 남은 일수 내림차순)POST /api/songs/promotions— 홍보 신청 + 포인트 차감 (인증 필요, KST 기준 내일부터)src/lib/api/songPromotion.ts— axios 래퍼src/queries/songPromotionQuery.ts— TanStack Query 훅src/components/SongPromotionModal.tsx— 달력 range picker로 기간 선택 (내일~, KST)src/components/PromotionBanner.tsx— 3초 간격 아래 방향 스크롤 전광판기존 파일 수정
SearchResultCard.tsx— 홍보 버튼 추가, 댓글 섹션 연결, 홍보 모달 연결HomePage.tsx— 초기 화면에 PromotionBanner 배치마무리
/verify— 빌드·린트 검증/commit— 커밋/pr— PR 생성DB 설계