개요

여행기는 워크스페이스 단위로 관리되는 마크다운 기반 여행 일지다. 사진은 두 가지 방식으로 챨부할 수 있다.

공통 사항

항목 값
Base URL http://localhost:8080
인증 Authorization: Bearer <JWT> 헤더 필수
Content-Type application/json (파일 업로드 제외)

공통 응답 래퍼

{ "success": true, "data": { ... } }

실패 시: { "success": false, "code": "ERROR_CODE", "message": "오류 메시지" }

API 목록

메서드 경로 설명
GET /api/workspaces/{workspaceId}/travellogs 여행기 목록 조회 (content 제외)
GET /api/workspaces/{workspaceId}/travellogs/{logId} 여행기 단건 조회 (사진 포함)
POST /api/workspaces/{workspaceId}/travellogs 여행기 생성
PATCH /api/workspaces/{workspaceId}/travellogs/{logId} 여행기 수정 (부분 수정)
DELETE /api/workspaces/{workspaceId}/travellogs/{logId} 여행기 삭제
POST .../{logId}/photos/upload 새 사진 업로드 후 첨부
POST .../{logId}/photos 앨범 사진 첨부
DELETE .../{logId}/photos 사진 첨부 해제

데이터 타입 참고

Weather: SUNNY | CLOUDY | RAINY | SNOWY

interface TravellogSummaryResponse {
  id: number; day: number | null; travelDate: string | null;
  title: string; weather: "SUNNY" | "CLOUDY" | "RAINY" | "SNOWY" | null;
  photoCount: number; createdAt: string;
}

interface TravellogResponse {
  id: number; day: number | null; travelDate: string | null;
  title: string; content: string;
  weather: "SUNNY" | "CLOUDY" | "RAINY" | "SNOWY" | null;
  workspaceId: number; authorId: number; authorNickname: string;
  photos: PhotoResponse[]; createdAt: string; updatedAt: string;
}

interface PhotoResponse {
  id: number; url: string; uploadedById: number; uploadedByNickname: string;
  takenAt: string | null; latitude: number | null; longitude: number | null;
  matchedDay: number | null; createdAt: string;
}

엔드포인트 상세

1. 여행기 목록 조회

GET /api/workspaces/{workspaceId}/travellogs — content(본문)는 포함되지 않는다.

{ "success": true, "data": [
  { "id": 1, "day": 1, "travelDate": "2025-07-01", "title": "도쿄 첫째 날", "weather": "SUNNY", "photoCount": 3, "createdAt": "2025-07-01T10:00:00" },
  { "id": 2, "day": 2, "travelDate": "2025-07-02", "title": "아사큰사 탐방", "weather": "CLOUDY", "photoCount": 0, "createdAt": "2025-07-02T09:30:00" }
]}

2. 여행기 단건 조회

GET /api/workspaces/{workspaceId}/travellogs/{logId} — content와 첨부 사진 전체를 반환한다.