Skip to content

API Docs ‐ Vote

6suhyeon edited this page Jul 29, 2024 · 6 revisions

API Documentation

Endpoints

1. Save Vote

- 투표 생성

  • Endpoint: /vote
  • Method: POST
  • Request:
    • userId : UUID
    • voteIntro : String
    • isDuplication : Boolean
    • endAt : LocalDateTime
    • voteItemList : VoteItem(voteItemContent)
      • voteItemContent : String
  • Request Example:
{
    "userId" : "3e3395b1-8326-4768-a27c-cd16b2e04e81",
    "voteIntro" : "애완동물",
    "isDuplication" : true,
    "endAt": "2024-07-20T11:00:00",
    "voteItemList": ["강아지가 귀여울까?","고양이가 귀여울까?"]
}
  • Response:
    • success : Boolean
    • message : String
    • voteId : UUID (unique)
  • Response Example:
  • Response Success Example
{
    "success": true,
    "voteId": "4a2345b1-8326-4768-a27c-cd16b2e04e81",
    "message": "투표 생성 성공"
}
  • Response Failure Example
{
    "success": false,
    "message": "투표 생성 시 DAO 저장 실패",
    "voteId": null
}

2. Delete Vote

- 투표 삭제

  • Endpoint: /vote
  • Method: DELETE
  • Request:
    • voteId : UUID
    • userId : UUID
  • Request Example:
{
    "voteId" : "4a2345b1-8326-4768-a27c-cd16b2e04e81",
    "userId" : "3e3395b1-8326-4768-a27c-cd16b2e04e81"
}
  • Response:
    • success : Boolean
    • message : String
  • Response Example:
  • Response Success Example
{
    "success": true,
    "message": "투표 삭제 성공"
}
  • Response Failure Example
{
    "success": false,
    "message": "투표 삭제 실패",
}

3. Get Vote

- 메인화면 인기투표 조회

  • Endpoint: /vote
  • Method: GET
  • Request: : None
  • Response:
    • success : Boolean
    • message : String
    • voteInfo : Vote(voteId, voteIntro, voteCount, endAt, voteItemCount, voteItemContent)
      • voteId : UUID
      • voteIntro : String
      • voteCount : Integer
      • endAt : LocalDateTime
      • voteItemCount : Integer
      • voteItemContent : String
  • Response Example:
  • Response Success Example
{
    "success": true,
    "voteInfo": {
        "voteId": "039c0aa8-f81b-4410-8e32-08ca641632b9",
        "voteIntro": "애완동물",
        "voteCount": 12,
        "endAt": "2024-07-20T11:00:00",
        "voteItemCount": 0,
        "voteItemContent": "강아지가 귀여울까?"
    },
    "message": "투표 조회 성공"
}
  • Response Failure Example
{
    "success": false,
    "message": "투표 조회 시 DAO 검색 실패",
    "voteInfo": null
}

4. Get Vote All

- 투표 전체 조회

  • Endpoint: /vote/all
  • Method: GET
  • Request: : None
  • Response:
    • success : Boolean
    • message : String
    • voteList : Vote(voteId, voteIntro, voteCount, endAt, voteItemCount, voteItemContent)
      • voteId : UUID
      • voteIntro : String
      • voteCount : Integer
      • endAt : LocalDateTime
      • voteItemCount : Integer
      • voteItemContent : String
  • Response Example:
  • Response Success Example
{
    "success": true,
    "voteList": [
        {
            "voteId": "9e54be08-c1dc-4055-b28b-6dc85743b0f2",
            "voteIntro": "음식",
            "voteCount": 10,
            "voteItemCount": 6,
            "voteItemContent": "육회",
            "endAt": "2024-07-18T01:38:44.736476"
        },
        {
            "voteId": "d444569f-a84c-46a6-b20f-776e1a221650",
            "voteIntro": "애완동물",
            "voteCount": 3,
            "voteItemCount": 2,
            "voteItemContent": "고양이가 귀여울까?",
            "endAt": "2024-07-18T01:41:19.43173"
        },
        {
            "voteId": "039c0aa8-f81b-4410-8e32-08ca641632b9",
            "voteIntro": "게임",
            "voteCount": 12,
            "voteItemCount": 0,
            "voteItemContent": "",
            "endAt": "2024-07-20T11:00:00"
        },
        {
            "voteId": "3283e8a8-6597-4d69-91af-f88acfd4383e",
            "voteIntro": "여행",
            "voteCount": 0,
            "voteItemCount": 0,
            "voteItemContent": "바다",
            "endAt": "2024-07-20T11:00:00"
        }
    ],
    "message": "투표 전체 조회 성공"
}
  • Response Failure Example
{
    "success": false,
    "message": "투표 전체 조회 시 DAO 검색 실패",
    "voteList": null
}

5. Get Vote All My

- 내가 만든 투표 전체 조회

  • Endpoint: /vote/all/user/{userId}
  • Method: GET
  • Request: : None
  • Response:
    • success : Boolean
    • message : String
    • voteList : Vote(voteId, voteIntro, voteCount, endAt, voteItemCount, voteItemContent)
      • voteId : UUID
      • voteIntro : String
      • voteCount : Integer
      • endAt : LocalDateTime
      • voteItemCount : Integer
      • voteItemContent : String
  • Response Example:
  • Response Success Example
{
    "success": true,
    "voteList": [
        {
            "voteId": "9e54be08-c1dc-4055-b28b-6dc85743b0f2",
            "voteIntro": "음식",
            "voteCount": 10,
            "voteItemCount": 6,
            "voteItemContent": "육회",
            "endAt": "2024-07-18T01:38:44.736476"
        },
        {
            "voteId": "d444569f-a84c-46a6-b20f-776e1a221650",
            "voteIntro": "애완동물",
            "voteCount": 3,
            "voteItemCount": 2,
            "voteItemContent": "고양이가 귀여울까?",
            "endAt": "2024-07-18T01:41:19.43173"
        },
    ],
    "message": "내가 만든 투표 전체 조회 성공"
}
  • Response Failure Example
{
    "success": false,
    "message": "내가 만든 투표 전체 조회 시 DAO 검색 실패",
    "voteList": null
}

Clone this wiki locally