개요

워크스페이스 구성원들이 여행 사진/김을 SNS형 피드로 공유하는 API. 게시글(카드) 단위에 좋아요/덩부을 달는다.

공통 사항

항목 값
Base URL http://localhost:8080
인증 Authorization: Bearer <JWT> 헤더 필수

API 목록

메서드 경로 설명
GET /api/workspaces/{workspaceId}/feeds 피드 목록 조회 (페이징)
GET /api/workspaces/{workspaceId}/feeds/{feedId} 피드 단일 조회
POST /api/workspaces/{workspaceId}/feeds 피드 생성
DELETE /api/workspaces/{workspaceId}/feeds/{feedId} 피드 삭제
POST /api/workspaces/{workspaceId}/feeds/{feedId}/likes 좋아요 토글
GET /api/workspaces/{workspaceId}/feeds/{feedId}/comments 덩글 목록
POST /api/workspaces/{workspaceId}/feeds/{feedId}/comments 덩글 작성
DELETE .../comments/{commentId} 덩글 삭제

1. 피드 목록 조회

GET /api/workspaces/{workspaceId}/feeds?page=0&size=20

{ "success": true, "data": {
  "content": [
    { "feedId": 1, "authorId": 42, "authorNickname": "상민",
      "content": "도쿄 여행 즐겁았어요!", "imageUrls": ["https://..."],
      "likeCount": 5, "liked": false, "commentCount": 2, "createdAt": "2025-07-01T10:00:00" }
  ],
  "pageable": { "pageNumber": 0, "pageSize": 20 }, "totalElements": 43, "last": false
}}

liked는 요정자 기준 좋아요 여부 — 토금 버튼 UI에 직접 매플.

2. 피드 생성

POST /api/workspaces/{workspaceId}/feeds (multipart/form-data)

필드 타입 필수 설명
content string ✅ 게시글 본문
images file[] - 사진 (최대 10개, jpeg/png/webp, 개당 10MB)
const formData = new FormData();
formData.append('content', content);
images.forEach(img => formData.append('images', img));

await fetch(`/api/workspaces/${workspaceId}/feeds`, {
  method: 'POST', headers: { Authorization: `Bearer ${token}` }, body: formData,
});

응답: 201 Created + 생성된 피드 객쟐

3. 좋아요 토글

POST /api/workspaces/{workspaceId}/feeds/{feedId}/likes — 호출할 마다 좋아요 상태가 토글된다 (있으므섌 취소, 없으므섌 달기).

{ "success": true, "data": { "liked": true, "likeCount": 6 } }

응답에 바람 된 liked/likeCount로 UI 즉시 갱신 (리스트 재조회 미혹서 도 렽).

4. 덩글