-
Notifications
You must be signed in to change notification settings - Fork 0
선호 api 연결완료 #132
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
Merged
Merged
선호 api 연결완료 #132
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
코드 리뷰 코멘트
에러 처리 변경:
getExclusions및getPreferences에서 404 에러가 발생했을 때, 빈 배열을 반환하는 로직이 추가되었습니다. 이는 유용할 수 있지만, API 호출이 실제로 실패했을 때, 사용자가 이를 인지하지 못할 위험이 있습니다. 추가적인 로깅이나 통지를 고려해야 합니다.리턴 타입 미지정:
getExclusions와getPreferences함수의 리턴 타입이 지정되어 있지 않습니다. TypeScript의 이점을 활용하기 위해, 정확한 반환 타입을 명시하는 것이 좋습니다. 예를 들어,Promise<ExclusionResponse[]>와Promise<PreferenceResponse[]>와 같이 지정하면 더 명확합니다.중복된 코드:
addExclusions와addPreferences두 곳에 존재합니다. 각각의 음식 이름을 추가하는 반복문을 공통 함수로 분리하면 코드의 중복을 줄이고 유지보수를 쉽게 할 수 있습니다.에러 타입 불확실성:
error의 타입이any로 설정되어 있습니다. 보다 구체적인 에러 타입을 사용하면 에러 핸들링을 더욱 정확히 처리할 수 있습니다.대기 시간 고려:
addExclusions에서 각 음식에 대한 API 호출을 순차적으로 진행하는 경우, 많은 음식이 있을 경우 비효율적일 수 있습니다.Promise.all을 사용하여 병렬로 API 호출할 수 있는 방법을 고려해볼 수 있습니다.요청 내용의 유효성 검사 부족:
userId와foodName이 유효한지, 혹은 NULL 체크가 필요합니다. 이 검사를 통해 API 호출 전에 불필요한 요청을 방지할 수 있습니다.이 외에도, 주석에서 한국어와 영어가 혼합되어 있는 점, 일관성을 유지하기 위해 한국어로 통일하는 것이 좋습니다.