-
Notifications
You must be signed in to change notification settings - Fork 0
FIX: separate get doctor api to auth and non-auth #22
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
base: main
Are you sure you want to change the base?
Conversation
token 없는 경우 GET 요청 수정
|
| * GET method만 허용한다. | ||
| """ | ||
| queryset = Doctor.objects.all() | ||
| permission_classes = [IsAuthenticated] |
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.
permission class IsDoctor를 만들어도 좋을 것 같아요.
| if queryset is None: | ||
| queryset = self.get_queryset() | ||
|
|
||
| return queryset.filter(user=self.request.user).get() |
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.
| if queryset is None: | |
| queryset = self.get_queryset() | |
| return queryset.filter(user=self.request.user).get() | |
| return self.request.user.doctor |
permission으로 의사 구분할거면 이렇게 해도 될 것 같고 아니라면
get_object_or_404라고 원래 get_object에서 사용하는 없으면 404 not found 바로 리턴하는 거 있는데 그거 써도 좋을 것 같아요.
| class ReadOnlyUserSerializer(serializers.ModelSerializer): | ||
| class Meta: | ||
| model = User | ||
| fields = ('id', 'email', 'name', ) |
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.
readonly면
read_only_fields = fields
추가하면 좋을듯 합니다.
|
확인했습니다. 🙂 |
doctor 모듈 GET API 수정
todo