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

feat: Create notification FastAPI #468

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open

Conversation

Qndndn
Copy link
Contributor

@Qndndn Qndndn commented Apr 28, 2024

Create notification FastAPI.v2

@Qndndn Qndndn marked this pull request as draft April 28, 2024 14:31
@Qndndn Qndndn self-assigned this Apr 28, 2024
Copy link
Contributor

@hyukychang hyukychang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

일단 코드가 돌아가는지 확인해 주세요

Comment on lines 37 to 39
related_comment_id=notification.related_comment_id,
is_read=False
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is_read 값은 왜 항상 false 인가요?

Comment on lines 14 to 16
queryset = Notification.objects.filter(
notification_read_log_set__read_by=self.request.user,
).select_related(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self에는 유저가 없어 보여요 ㅠㅠ

Comment on lines 42 to 44
notifications = self.get_all_notifications()
NotificationReadLog.objects.filter(notification__in=notifications, read_by=self.request.user).update(is_read=True)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

notification과 notificationReadLog랑은 무슨 차이가 있나요??

@Qndndn Qndndn marked this pull request as ready for review May 14, 2024 07:52
Comment on lines 24 to 30
return [
notification
for notification in notifications
if NotificationReadLog.objects.filter(
notification=notification, read_by=user_id, is_read=False
).exists()
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

요거 N+1 쿼리일 가능성이 높아 보이는데 시간 나면 리팩토링 하거나 TODO 체크해주세요 👍

Comment on lines 59 to 63
return "실명"
elif article.name_type == NameType.REGULAR:
return "nickname"
else:
related_comment = None
return "익명"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"실명", "nickname", "익명" 전부다 constant로 지정해서 사용해주세요!!!!

return "익명"

def create_notification(self, comment: Comment) -> None:
def notify_article_commented(_parent_article: Article, _comment: Comment):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

변수에 왜 _가 들어있나요?

if comment.parent_comment:
parent_comment = comment.parent_comment
related_comment = parent_comment
def get_display_name(self, article: Article, profile: int):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이거는 외부로 노출(domain 이나 다른 infra layer에서 사용할거 같아 보이는게 아닌)되지 않으면 함수명에 _ 붙여 주세요

related_comment = None
return "익명"

def create_notification(self, comment: Comment) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이거 transaction이 붙어야 할거 같아요 음... 근데 이거는 어려울 수도 있으니까 같이 한번 봐요

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

넵~!

@Qndndn Qndndn requested a review from hyukychang July 24, 2024 16:07
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

Successfully merging this pull request may close these issues.

2 participants