Skip to content

곡 댓글 및 홍보(전광판) 기능 추가 #223

@GulSam00

Description

@GulSam00

작업 개요

SearchResultCard에서 곡 댓글 기능과 홍보(전광판) 기능을 추가한다. 두 기능 모두 회원 전용이며 새로운 Supabase 테이블이 필요하다.

작업 체크리스트

DB

  • Supabase에 song_comments 테이블 생성
  • Supabase에 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 — 커밋
  • Supabase DB 테이블 생성 후 실제 동작 확인
  • /pr — PR 생성

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);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions