[API]Curation - gyunam-bark/nb02-how-do-i-look-team1 GitHub Wiki

큐레이팅 API 위키

이 문서는 큐레이탕 관련 기능을 제공하는 API 엔드포인트들을 설명합니다. 큐레이팅은 특정 스타일에 종속되거나 독립적인 개별 수정/삭제 작업을 가집니다.


1. 큐레이팅 등록 (Create Curation)

특정 스타일에 대한 새로운 큐레이팅을 등록합니다.

  • HTTP Method: POST
  • Endpoint: /styles/:styleId/curations

요청 (Request)

  • Path Parameters:
    • styleId (number, 필수): 큐레이팅을 등록할 스타일의 고유 ID.
  • Body Parameters:
    • nickname (string, 필수): 큐레이팅 작성자의 닉네임. (1 ~ 32자)
    • password (string, 필수): 큐레이팅 수정/삭제 시 필요한 비밀번호. (4 ~ 16자)
    • trendy (number, 필수): 트렌디 점수. (0 이상)
    • personality (number, 필수): 개성 점수. (0 이상)
    • practicality (number, 필수): 실용성 점수. (0 이상)
    • costEffectiveness (number, 필수): 가성비 점수. (0 이상)
    • content (string, 필수): 큐레이팅 내용. (1 ~ 256자)

응답 (Response)

  • 성공 (Success: 201 Created)
{
  "curationId": 123,
  "styleId": 1,
  "nickname": "큐레이터1",
  "password": "hashed_password",
  "trendy": 8,
  "personality": 7,
  "practicality": 9,
  "costEffectiveness": 6,
  "content": "이 스타일에 대한 큐레이션 내용입니다.",
  "createdAt": "2023-10-26T10:00:00.000Z",
  "updatedAt": "2023-10-26T10:00:00.000Z",
  "comments": [],
  "style": {
    "styleId": 1,
    "nickname": "스타일작성자",
    "title": "멋진 스타일 제목",
    "content": "스타일 상세 내용",
    "curationCount": 5,
    "viewCount": 100,
    "createdAt": "2023-10-25T09:00:00.000Z",
    "updatedAt": "2023-10-25T09:00:00.000Z",
    "categories": {
      "top": { "name": "티셔츠", "brand": "브랜드A", "price": "25000" },
      "bottom": { "name": "청바지", "brand": "브랜드B", "price": "50000" }
    },
    "images": [
      { "imageId": 1, "imageUrl": "http://example.com/image1.jpg" }
    ],
    "tags": ["데일리룩", "캐주얼"]
  },
  "comment": null
}
  • 실패 (Error: 404 Not Found)
{
  "message": "스타일을 찾을 수 없습니다."
}

2. 큐레이팅 목록 조회 (Get Curation List)

특정 스타일에 등록된 큐레이팅 목록을 조회합니다. 페이지네이션 및 검색 기능을 지원합니다.

  • HTTP Method: GET
  • Endpoint: /styles/:styleId/curations

요청 (Request)

  • Path Parameters:
    • styleId (number, 필수): 큐레이팅을 조회할 스타일의 고유 ID.
  • Query Parameters:
    • page (number, 선택): 조회할 페이지 번호. (기본값: 1, 1 이상)
    • pageSize (number, 선택): 페이지당 큐레이션 개수. (기본값: 10, 0 이상)
    • searchBy (string, 선택): 검색 기준. (nickname 또는 content)
    • keyword (string, 선택): 검색어. (0 ~ 32자)

응답 (Response)

  • 성공 (Success: 200 OK)
{
  "currentPage": 1,
  "totalPages": 3,
  "totalItemCount": 25,
  "data": [
    {
      "curationId": 123,
      "styleId": 1,
      "nickname": "큐레이터1",
      "password": "hashed_password",
      "trendy": 8,
      "personality": 7,
      "practicality": 9,
      "costEffectiveness": 6,
      "content": "첫 번째 큐레이션입니다.",
      "createdAt": "2023-10-26T10:00:00.000Z",
      "updatedAt": "2023-10-26T10:00:00.000Z",
      "comments": [],
      "style": {
        "styleId": 1,
        "nickname": "스타일작성자",
        "title": "멋진 스타일 제목",
        "content": "스타일 상세 내용",
        "curationCount": 5,
        "viewCount": 100,
        "createdAt": "2023-10-25T09:00:00.000Z",
        "updatedAt": "2023-10-25T09:00:00.000Z",
        "categories": {
          "top": { "name": "티셔츠", "brand": "브랜드A", "price": "25000" }
        },
        "images": [
          { "imageId": 1, "imageUrl": "http://example.com/image1.jpg" }
        ],
        "tags": ["데일리룩", "캐주얼"]
      },
      "comment": null
    },
    {
      "curationId": 124,
      "styleId": 1,
      "nickname": "패셔니스타",
      "password": "hashed_password",
      "trendy": 9,
      "personality": 8,
      "practicality": 7,
      "costEffectiveness": 8,
      "content": "두 번째 큐레이션입니다.",
      "createdAt": "2023-10-26T11:00:00.000Z",
      "updatedAt": "2023-10-26T11:00:00.000Z",
      "comments": [
        {
          "commentId": 1,
          "content": "정말 좋은 큐레이션이네요!",
          "password": "comment_pw",
          "createdAt": "2023-10-26T12:00:00.000Z",
          "updatedAt": "2023-10-26T12:00:00.000Z"
        }
      ],
      "style": {
        // ... (위와 동일한 style 객체 구조)
      },
      "comment": {
        "id": 1,
        "content": "정말 좋은 큐레이션이네요!",
        "password": "comment_pw",
        "createdAt": "2023-10-26T12:00:00.000Z",
        "updatedAt": "2023-10-26T12:00:00.000Z"
      }
    }
  ]
}
  • 실패 (Error: 400 Bad Request)
{
  "message": "페이지 및 페이지 크기는 1 이상의 유효한 숫자여야 합니다."
}
{
  "message": "유효하지 않은 검색 기준입니다."
}
  • 실패 (Error: 404 Not Found)
{
  "message": "스타일을 찾을 수 없습니다."
}

3. 큐레이션 수정 (Update Curation)

특정 큐레이션의 내용을 수정합니다.

  • HTTP Method: PUT
  • Endpoint: /curations/:curationId

요청 (Request)

  • Path Parameters: curationId (number, 필수): 수정할 큐레이션의 고유 ID.
  • Body Parameters:
    • password (string, 필수): 큐레이션 수정/삭제 시 필요한 비밀번호. (4 ~ 16자)
    • nickname (string, 필수): 큐레이션 작성자의 닉네임. (1 ~ 32자)
    • trendy (number, 필수): 트렌디 점수. (0 이상)
    • personality (number, 필수): 개성 점수. (0 이상)
    • practicality (number, 필수): 실용성 점수. (0 이상)
    • costEffectiveness (number, 필수): 가성비 점수. (0 이상)
    • content (string, 필수): 큐레이션 내용. (1 ~ 256자)

응답 (Response)

  • 성공 (Success: 200 OK)
{
  "curationId": 123,
  "styleId": 1,
  "nickname": "수정된닉네임",
  "password": "hashed_password",
  "trendy": 9,
  "personality": 8,
  "practicality": 8,
  "costEffectiveness": 7,
  "content": "수정된 큐레이션 내용입니다.",
  "createdAt": "2023-10-26T10:00:00.000Z",
  "updatedAt": "2023-10-26T10:30:00.000Z"
}
  • 실패 (Error: 403 Forbidden)
{
  "message": "비밀번호가 일치하지 않습니다."
}
  • 실패 (Error: 404 Not Found)
{
  "message": "큐레이팅을 찾을 수 없습니다."
}

4. 큐레이션 삭제 (Delete Curation)

특정 큐레이션을 삭제합니다.

  • HTTP Method: DELETE
  • Endpoint: /curations/:curationId

요청 (Request)

  • Path Parameters: curationId (number, 필수): 삭제할 큐레이션의 고유 ID.
  • Body Parameters: password (string, 필수): 큐레이션 수정/삭제 시 필요한 비밀번호. (4 ~ 16자)

응답 (Response)

  • 성공 (Success: 200 OK)
{
  "message": "큐레이팅 삭제 성공"
}
  • 실패 (Error: 403 Forbidden)
{
  "message": "비밀번호가 일치하지 않습니다."
}
  • 실패 (Error: 404 Not Found)
{
  "message": "큐레이팅을 찾을 수 없습니다."
}