Skip to content

feat: Admin CRUD API 구현#105

Merged
ryu9663 merged 8 commits intomainfrom
feat/admin-api
Jan 27, 2026
Merged

feat: Admin CRUD API 구현#105
ryu9663 merged 8 commits intomainfrom
feat/admin-api

Conversation

@ryu9663
Copy link
Owner

@ryu9663 ryu9663 commented Jan 27, 2026

Summary

  • ADMIN_PASSWORD 기반 Bearer 토큰 인증 헬퍼 (timingSafeEqual 적용)
  • Posts CRUD API: 목록/상세/생성/수정/삭제
  • Categories CRUD API: 목록/생성/수정/삭제
  • S3 이미지 업로드 API (파일 타입/사이즈 검증, CloudFront URL 반환)
  • Supabase service role 기반 createAdminClient (RLS 우회)

API Endpoints

Method Endpoint 설명
GET /api/admin/posts 전체 포스트 목록
POST /api/admin/posts 포스트 생성
GET /api/admin/posts/[id] 포스트 상세
PUT /api/admin/posts/[id] 포스트 수정
DELETE /api/admin/posts/[id] 포스트 삭제
GET /api/admin/categories 카테고리 목록
POST /api/admin/categories 카테고리 생성
PUT /api/admin/categories/[id] 카테고리 수정
DELETE /api/admin/categories/[id] 카테고리 삭제
POST /api/admin/upload 이미지 업로드 (S3)

Test plan

  • pnpm build 빌드 성공 확인
  • 인증 없이 요청 시 401 응답 확인
  • curl로 각 엔드포인트 정상 동작 확인
  • 잘못된 입력 시 400 응답 확인
  • S3 업로드 후 CloudFront URL 접근 확인

🤖 Generated with Claude Code

ryu9663 and others added 8 commits January 27, 2026 20:57
Supabase 관련 환경변수를 .env.example에 추가하고,
.mcp.json과 migration output을 gitignore에 추가

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
DatoCMS → Supabase 마이그레이션 완료에 따라 문서를 현행화.
Feature Flag 이중 데이터 소스, Supabase 스키마, 컨버터 패턴,
AWS S3/CloudFront 이미지 호스팅, 환경변수 전체 목록 등 추가.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- validateAdmin with timing-safe password comparison
- createAdminClient (untyped, postgrest-js compat workaround)
- GET /api/admin/posts (all posts with joins)
- POST /api/admin/posts (with input validation)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- GET single post with joins, 404 handling
- PUT partial update with input validation
- DELETE hard delete

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- GET all categories ordered by main/sub
- POST with input validation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- PUT partial update with input validation
- DELETE hard delete

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- File type whitelist (jpeg, png, webp, gif)
- 10MB size limit
- Width/height validation
- S3 upload with CloudFront URL response
- images table record creation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Jan 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
blog Ready Ready Preview, Comment Jan 27, 2026 0:42am

@ryu9663 ryu9663 merged commit 350809c into main Jan 27, 2026
2 of 3 checks passed
@ryu9663 ryu9663 deleted the feat/admin-api branch January 27, 2026 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant