Conversation
Collaborator
Author
|
리뷰 부탁드립니다😀 |
maitracle
reviewed
Apr 30, 2020
Comment on lines
-17
to
-23
|
|
||
| def get(self, url, data=None, json=None, timeout=None, auth=None, **options): | ||
| return self.request('GET', url, data=data, json=json, timeout=timeout, auth=auth, *options) | ||
|
|
||
| def post(self, url, data=None, json=None, timeout=None, auth=None, **options): | ||
| return self.request('POST', url, data=data, json=json, timeout=timeout, auth=auth, *options) | ||
|
|
| from django.urls import path | ||
| from rest_framework.routers import SimpleRouter | ||
| from rest_framework_simplejwt.views import TokenRefreshView | ||
|
|
| @@ -0,0 +1,23 @@ | |||
| import os | |||
Comment on lines
+156
to
+158
|
|
||
|
|
||
|
|
| assert_that(rest_coin).is_equal_to(expected_rest_coin) | ||
|
|
||
| def _check_response_and_expected(self, dictionary, instance): | ||
|
|
Comment on lines
+361
to
+362
| assert_that(response.data['coin_history_last']['rest_coin']).is_equal_to(rest_coin) | ||
| # assert_that(CoinHistory.objects.filter(profile=profile).last().rest_coin).is_equal_to(rest_coin) |
Owner
There was a problem hiding this comment.
여기도 coin history의 다른 필드들도 검사해주시고, 필요없는 코드는 삭제해주세요.
Comment on lines
+32
to
+45
|
|
||
|
|
||
| class RetrieveCoinHistorySerializer(serializers.ModelSerializer): | ||
| class Meta: | ||
| model = CoinHistory | ||
| fields = ( | ||
| 'id', | ||
| 'profile', | ||
| 'rest_coin', | ||
| 'reason', | ||
| 'message', | ||
| 'created_at', | ||
| 'updated_at', | ||
| ) |
Owner
There was a problem hiding this comment.
ListCoinHistorySerializer와 똑같으니 굳이 하나 더 만들지 않아도 될 것 같아요.
chat_link 필드는 CharField, last_coin_history 필드는 ListCoinHistorySerializer로 ChatLinkSerializer를 하나 만들어주세요.
| response_target_chat_link = request_self_date_profile.get_target_chat_link(target_self_date_profile) | ||
| chat_link = { | ||
| coin_history_last = request.user.profile.coin_histories.last() | ||
| coin_history_last = RetrieveCoinHistorySerializer(coin_history_last) |
Owner
There was a problem hiding this comment.
serializer를 이런식으로 사용하는 것 보단,
위의 serializer_class_by_actions에 새로 만든 ChatLinkSerializer를 추가하고, 이곳에선 self.get_serializer를 호출하여 사용하는게 더 좋아보여요.
Owner
There was a problem hiding this comment.
ChatLinkSerializer에 response_link_coin dictionary 전체를 넣고 전체를 serializing 해주세요
Comment on lines
+116
to
+118
|
|
||
|
|
||
|
|
Comment on lines
-33
to
-35
|
|
||
| expected_profile = Profile.objects.get(nickname=profile_data['nickname']) | ||
|
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
셀소 detail get_chat_link에 coin_history response로 주기
References
Checklist