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

Issue for codesmell in backend works/:id/reviews and reviews/board/ #50

Open
hursuhyun opened this issue Nov 25, 2021 · 0 comments
Open
Assignees

Comments

@hursuhyun
Copy link
Contributor

hursuhyun commented Nov 25, 2021

works/:id/reviewsreviews/board/(그 외 더 많은 부분이 존재할 수 있음)에서 foreign_key로 object를 가져오는게 안 되어서 일일이 값을 넣어주어야 하는데 이 부분을 통합하면 좋을 것 같습니다.

    for review in board_reviews:
        work = review.work
        work_artist_name = [artist.name for artist in work.artists.all()]

        work_dict = {
            "id": work.id, "title": work.title, "thumbnail_picture": work.thumbnail_picture,
            "platform_id": work.platform_id, "year": work.year, "artists": work_artist_name
        }

        author = User.objects.get(id=review.author_id)
        author_dict = {
            "id": author.id, "username": author.username, "email": author.email, # "profile_picture": author.profile_picture
        }
        response_dict.append({
            "id": review.id, "title": review.title, "content": review.content, "score": review.score, "likes": review.likes,
            "work": work_dict, "author": author_dict
        })
@hursuhyun hursuhyun self-assigned this Nov 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant