Skip to content

Comment API

joonhoPark edited this page Nov 12, 2020 · 15 revisions

해당 Issue의 모든 Comment 목록

Method Endpoint
GET /issues/:id/comments
  • responses
    • 성공

      res.status(200).json({
        success: true,
        data: [{
            id: <comment_id>,
            userId: <user_id>,
            nickname: <user_nickname>,
            profileUrl: <user_profileUrl>,
            content: <comment_content>,
            createdAt: <comment_createdAt>,
        }, {...},
        ]
      })
    • 잘못된 요청

      • 파라미터가 잘못왔을 때 (존재하지 않는 이슈 ID)
      res.status(400).json({
        success: false,
        message: "파라미터 값이 잘못 되었습니다.",
      })
      
    • DB 에러

      res.status(600).json({
        success: false,
        message: "데이터베이스 에러",
      })
    • 서버 내부 에러

      res.status(500).json({
        success: false,
        message: "서버 내부 오류",
      })

Comment 생성

Method Endpoint
POST /issues/:id/comments
  • body

    {
        uesrId: <user_id>,
        content: <comment_content>,
    }
  • responses

    • 성공

      res.status(201).json({
        success: true,
        data: {
            id: <comment_id>,
        }
      })
    • 잘못된 요청

      • 파라미터가 안오거나 잘못왔을 때
      res.status(400).json({
        success: false,
        message: "파라미터 값이 잘못 되었습니다.",
      })
      
    • DB 에러

      res.status(600).json({
        success: false,
        message: "데이터베이스 에러",
      })
    • 서버 내부 에러

      res.status(500).json({
        success: false,
        message: "서버 내부 오류",
      })

Comment 수정

Method Endpoint
PATCH /comments/:id
  • body

    {
        content: <comment_content>,
    }
  • responses

    • 성공

      res.status(200).json({
        success: true,
      })
    • 잘못된 요청

      • 파라미터가 안오거나 잘못왔을 때
      res.status(400).json({
        success: false,
        message: "파라미터 값이 잘못 되었습니다.",
      })
      • 데이터가 변경되지 않았을 때
      res.status(304)
    • DB 에러

      res.status(600).json({
        success: false,
        message: "데이터베이스 에러",
      })
    • 서버 내부 에러

      res.status(500).json({
        success: false,
        message: "서버 내부 오류",
      })

이미지 url 생성

Method Endpoint
POST /comment-image-urls
  • image format
jpeg|png|jpg
  • responses
    • 성공
      res.status(200).json({
        success: true,
        data: {
            url: <url>
        }
      })
    • 잘못된 요청
      • 파라미터가 안오거나 잘못왔을 때
      res.status(400).json({
        success: false,
        message: "파라미터 값이 잘못 되었습니다.",
      })
    • DB 에러
      res.status(600).json({
        success: false,
        message: "데이터베이스 에러",
      })
    • 서버 내부 에러
      res.status(500).json({
        success: false,
        message: "서버 내부 오류",
      })

Clone this wiki locally