[엉박사] API 설계

impala·2023년 4월 5일
0

[리팩토링] 엉박사

목록 보기
3/3
post-thumbnail

기존 API는 REST API 아키텍쳐를 따르지 않고 주관적으로 만들었기 때문에 url을 그대로 유지하면서 동일한 기능을 만들기에는 무리가 있다고 판단했다. 그래서 최대한 기존 서버가 제공하는 기능을 모두 지원하되 uri는 자원을, HTTP메소드는 자원을 다루는 행위에 집중하여 API를 전체적으로 개편하였다.

Member

/login

  • POST : 로그인
    • request
      • login_id
      • password
    • response
      • token

/members

  • GET : 회원 리스트 조회
    • response
      • members
  • POST : 회원가입
    • request
      • login_id
      • password
      • name
      • nickname
      • school
      • introduction
    • response
      • member_id

/members/{id}

  • GET : 회원 조회
    • response
      • member_id
      • name
      • nickname
      • school
      • tier
      • background_id
      • accessory_id
      • genre_score_id
      • ability_id
  • DELETE : 회원 탈퇴
  • PUT : 회원 정보 변경
    • request
      • name
      • nickname
      • school
      • introduction
    • response
      • member_id

/members/{id}/background

  • PUT : 배경 이미지 변경
    • request
      • background_id

/members/{id}/accessory?type=

  • PUT : 악세사리 변경
    • type(required) : h, f, b
    • request
      • accessory_id

/genre-scores/{id}

  • GET : 회원의 장르점수 조회
    • response
      • novel_score
      • essay_score
      • drama_score
      • biography_score
      • non_literature_score

/abillities/{id}

  • GET : 회원의 능력치 조회
    • response
      • understanding_score
      • grammar_score
      • expression_score
      • composition_score
      • content_score

/backgrounds

  • GET : 배경 이미지 조회
    • response
      • backgrounds
        • background_id
        • imgUrl

/accessories?type=

  • GET : 악세서리 리스트 조회
    • type(required) : h, f, b
    • response
      • accessories
        • accessory_id
        • imgUrl

Book

/books

  • GET : 책 목록 조회
    • response
      • books
        • book_id
        • title
        • isbn
        • genre
        • description

/books/{id}/{chapter_num}

  • GET : 책의 한 챕터 조회
    • response
      • content

/keywords?book_id=

  • GET : 키워드 조회
    • book_id(required) : 책id
    • response
      • keywords
        • keyword_id
        • name

/quizzes?book_id=&chapter_num=

  • GET : 퀴즈 조회
    • book_id(required) : 책 id
    • chapter_num(required) : 챕터 번호
    • response
      • quizzes
        • quiz_id
        • quiz_num
        • content

/quizzes/{id}

  • POST : 정답 제출
    • request
      • choice_id
    • response
      • hint : 답이 틀리면 전송

/choices?quiz_id

  • GET : 문제 선택지 조회
  • quiz_id(required) : 퀴즈 id
    • response
      • choices
        • choice_id
        • content

/dictionary?word=

  • GET : 단어 검색. 국립국어원 API에 요청

Report

/reports?member_id=

  • GET : 회원이 작성한 독후감 목록
    • member_id : 회원id
    • response
      • reports
      • report_id
      • member_id
      • book_id
      • current_chapter_num
      • title
      • content
      • report_format
      • report_step
      • quiz_score
      • feedback_id
  • POST : 독서활동 생성
    • request
      • book_id
    • response
      • report_id

/reports/{id}

  • GET : 독서활동 조회
    • response
      • book_id
      • current_chapter_num
      • title
      • content
      • report_format
      • report_step
      • quiz_score
      • feedback_id
  • POST : 독후감 작성
    • request
      • title
      • content
      • report_format
      • response
      • feedback_id
  • PUT : 독후감 수정
    • request
      • title
      • content
      • report_format
    • response
      • feedback_id

/feedback/{id}

  • GET : 피드백 조회
    • response
      • report_id
      • correct
      • feedback

/activities?report_id=

  • GET : 단원 활동 전체 조회
    • report_id : 독서활동 id
    • response
      • activities
      • activity_id
      • chapter_num
      • questions
        • keyword
        • reason
        • summary
        • feeling
      • answers
        • keyword
        • reason
        • summary
        • feeling
  • POST : 단원 활동 생성
    • request
      • chapter_num
    • response
      • activity_id

/activities/{id}

  • GET : 단원활동 조회
    • response
      • activity_id
      • chapter_num
      • questions
        • keyword
        • reason
        • summary
        • feeling
      • answers
        • keyword
        • reason
        • summary
        • feeling
  • POST : 단원 활동 작성
    • request
      • keyword
      • reason
      • summary
      • feeling

0개의 댓글