Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REV-96/mock API (메인) 구현 #21

Merged
merged 8 commits into from
Nov 2, 2023
Merged

REV-96/mock API (메인) 구현 #21

merged 8 commits into from
Nov 2, 2023

Conversation

hyoribogo
Copy link
Member

PR 제목 지라 티켓명하고 똑같이 바꿔주세요! (브랜치명 XX)

📑 구현 내용

API 명세서 기준, 메인에 해당하는 mock API를 구현했습니다.

image

각각의 쿼리, 뮤테이션 훅은 아래와 같이 명명했습니다.

  • useEditResponse: 작성한 응답 수정
  • useGetCreatedReview
  • useGetInvitedReview
  • useGetReceivedReview
  • useGetResponseForm: 리뷰 응답자 리스트와 질문 폼 데이터
  • useGetReviewResult: 나에게 온 리뷰 결과 상세 데이터

🚧 참고 사항

  • dummyData 파일에 mock 데이터를 구현했습니다.
  • main 파일에 mainHandlers를 구현했습니다.

훅 사용법은 제 이전 프로젝트 wiki 링크 참고해서 저희한테 맞게끔 규칙 정하면 좋을 거 같습니다!


@hyoribogo hyoribogo added the 기능 새로운 기능을 개발합니다. label Nov 1, 2023
@hyoribogo hyoribogo self-assigned this Nov 1, 2023
Copy link
Collaborator

@hayamaster hayamaster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다 효리님!

useGetCreatedReview, useGetInvitedReview, useGetReceivedReview 뒤에 '-s'를 붙이는 것은 어떨까요? useGetReceivedReviewuseGetReviewResult가 계속 헷갈리더라고요...! -List도 생각해봤지만, 컴포넌트보다는 api관련 훅이니까 붙인다면 -s가 적합할 것 같습니다!

  • 앞으로 PR제목 지라 티켓명과 똑같이 하겠습니다 🥹

Comment on lines +4 to +18
interface Answer {
questionId: number
questionType: string
answer: string[]
}

interface Result {
reviewerId: number
answers: Answer[]
}

interface Response {
responseId: number
results: Result[]
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interface Response {
  responseId: number
  results: {
    reviewerId: number
    answers: {
      questionId: number
      questionType: string
      answer: string[]
    }
  }
}

저는 그냥 한 번에 때려 박는?다고 생각했는데, 대부분 depth가 깊어지면 분리하여 type을 작성할까요??

Copy link
Collaborator

@khj0426 khj0426 Nov 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

뭔가 detph가 깊어지면 분리하는게 필요할 거 같습니다 (너무 복잡해질거 같아서,,depth가 깊어진다면?!)

Comment on lines +1 to +5
export const MY_INFO = {
id: 1,
name: '[프론트엔드]김아무개',
email: 'amugae@naver.com',
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저는 Dummy 데이터들은 handlers 파일 상단에 정의해두긴 했습니다만, 공통으로 빼는 것도 좋을 것 같습니다!

Comment on lines +15 to +18
interface Response {
responseId: number
results: Result[]
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저는 -Props라고 이름을 붙여줬습니다. editResponseProps처럼요! 어떤 것이 나을까요??

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

요건 의논을 한번 해봐야 할 것 같습니당..!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이거는 컴포넌트가 아니라서 props가 아니지 않나요?!!

@@ -0,0 +1,29 @@
import { rest } from 'msw'
import {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저도 분류를 해야겠네욤..!

}

return useQuery({
queryKey: ['/received-reviews', 'result'],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

쿼리 키로 URL을 집어넣는게 어떨까요?

queryKey:[`/received-reviews/${reviewId}`]

이런형식으로 될 거 같은데 reviewId에 따라 바뀔 필요가 없을까요.?!?!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오우 이런 방법이 있군요!!!

Comment on lines +4 to +18
interface Answer {
questionId: number
questionType: string
answer: string[]
}

interface Result {
reviewerId: number
answers: Answer[]
}

interface Response {
responseId: number
results: Result[]
}
Copy link
Collaborator

@khj0426 khj0426 Nov 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

뭔가 detph가 깊어지면 분리하는게 필요할 거 같습니다 (너무 복잡해질거 같아서,,depth가 깊어진다면?!)

Comment on lines +15 to +18
interface Response {
responseId: number
results: Result[]
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

요건 의논을 한번 해봐야 할 것 같습니당..!

@hyoribogo hyoribogo merged commit bfde7b9 into develop Nov 2, 2023
1 check passed
@hyoribogo hyoribogo deleted the REV-96/메인-모킹 branch November 2, 2023 05:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
기능 새로운 기능을 개발합니다.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants