-
Notifications
You must be signed in to change notification settings - Fork 2
School Meal API #587
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
School Meal API #587
Conversation
Killerwhale-Park
left a comment
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.
Api 엔드포인트 설계가 달라져야 할 것 같습니다.
- 날짜, 식당 id 등을 받아 해당하는 조건만 필터링 해서 주는 api가 필요합니다.
- 알러지 정보를 별도의 api로 분리하게 되면 메뉴 n개당 n번 호출되어 n+1 쿼리가 발생합니다.
Api 엔드포인트는 단순히 db테이블에서 꺼내오는 것 만이 아닌 상황에 따라 필요한 정보들을 모아거 보내줘야 합니다.
Killerwhale-Park
left a comment
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.
마이그레이션 파일 고쳐주세요!
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.
migration 파일은 날리면 안됩니다... 수정 사항이 있으면 migration 파일을 고치지 않고 새로 만들어야 합니다. 즉 0001과 0002가 있는 상황에서 수정 사항이 생기면, 그 수정사항은 0003 파일로 만들어야 합니다.
해결을 위해서 아래와 같이 작업해서 다시 커밋해주시면 되요!
- 로컬에서 마이그레이션 롤백하기 python manage.py migrate meal zero
- dev브랜치에서 0001과 0002 파일 받아서 로컬에서 작업하던 폴더에 붙여넣기
-
- 상태에서 다시 마이그레이션 만들기 (0003) -> python manage.py makemigrations
- 마이그레이션 진행 후 테스트 -> python manage.py migrate
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.
여기
try:
query_date = date_type(int(date_str[:4]), int(date_str[4:6]), int(date_str[6:]))
except (ValueError, TypeError):
return Response({'error': 'Invalid date'}, status=status.HTTP_400_BAD_REQUEST)
이부분에서 잘못된 형식의 데이터에 대해서 에러 메서지를 조금 더 자세히 명시해 주세요
ex) 날짜가 틀린 경우 어떤 형식으로 와야 하는지
+) 테스트 케이스도 만들어 주세요!!
.