[KR] 댓글 API - 2022-dimipay-recruit/Flutter-Server GitHub Wiki

댓글 API


POST /answers/create

request:

  • body
    • postId (댓글을 달 질문 ID)
    • content (댓글 내용)
    • isAnony (익명 댓글인지 아닌지)
  • header
    • authorization: string (Bearer + JWT)

response:

{
  status: 'success',
  data: {
    answer: {
      id: string (UUID),
      content: string,
      createdAt: DateTime,
      updatedAt: DateTime,
      authorId: string,
      postId: string,
      isAnony: boolean (익명 답변인지),
      author: { 
        id: string (UUID),
        link: string (/^[a-z0-9]{6,16}$/),
        nickname: string (/^.{3,20}$/),
        email: string,
        profileImage: string,
        description: string
      },
      post: {
        id: string (UUID),
        title: string (/^.{1,50}$/),
        content: string (/^.{1,4000}$/),
        createdAt: string (ISO 8601 time),
        updatedAt: string (ISO 8601 time),
        isAnnony: boolean (익명인지 여부),
        isCommunity: boolean (커뮤니티 질문인지 여부, 커뮤니티이므로 언제나 true),
        imageLink: string (없을 경우 빈 값),
        reveiverId: string | null (수신인, 커뮤니티이므로 언제나 null),
        authorId: string (UUID, 작성인)
      }
    }
  }
}

error:

  • 400
    • Invalid authorization token
    • Invalid authorization header type

GET /answers/get/post/:postId

request:

  • params
    • postId (댓글을 조회할 질문 ID)
  • header
    • authorization: string (Bearer + JWT)

부연 : 전달한 UUID의 게시글의 댓글들을 배열로 반환합니다.

response:

{
  status: 'success',
  data: {
    answer: [(author와 post를 제외한 answer값 배열)]
  }
}

error:

  • 400
    • Invalid authorization token
    • Invalid authorization header type

GET /answers/get/author/:authorId

request:

  • params
    • authorId (댓글 리스트를 조회할 유저의 UUID)
  • header
    • authorization: string (Bearer + JWT)

response:

{
  status: 'success',
  data: {
    answer: [(author와 post를 제외한 answer값 배열)]
  }
}

error:

  • 400
    • Invalid authorization token
    • Invalid authorization header type

POST /answers/report/:answerId

request:

  • params
    • answerId (신고할 댓글 ID)
  • body
    • reason (댓글 신고 이유)
  • header
    • authorization: string (Bearer + JWT)

response:

{
  status: 'success'
}

error:

  • 400
    • Invalid authorization token
    • Invalid authorization header type