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: Creat notification FastAPI #465

Closed
wants to merge 2 commits into from

Conversation

Qndndn
Copy link
Contributor

@Qndndn Qndndn commented Apr 2, 2024

Create notification FastAPI

@Qndndn Qndndn added the refactor label Apr 2, 2024
@Qndndn Qndndn self-assigned this Apr 2, 2024
@Qndndn Qndndn marked this pull request as draft April 2, 2024 07:36
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.

이거 제가 올린 board 쪽 refactoring PR 봐주세요

이해가 안가는 부분은 Slack에 멘션 주세요!

Comment on lines +1 to +6
from fastapi import APIRouter, Depends, HTTPException
from ara.controller.authentication import get_current_user
from ara.service.notification_service import NotificationService
from ara.domain.user import User
from ara.domain.exceptions import EntityDoesNotExist
from pydantic import BaseModel
Copy link
Contributor

Choose a reason for hiding this comment

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

해당 파일은 ara/controller/notification/notification_controller.py로 빼주세요

@@ -0,0 +1,24 @@
from fastapi import HTTPException
Copy link
Contributor

Choose a reason for hiding this comment

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

해당 파일 도 경로가 틀렸습니다 제가 올린 board refactoring PR 봐주세요

@@ -0,0 +1,24 @@
from fastapi import HTTPException
from sqlalchemy.orm import Session
Copy link
Contributor

Choose a reason for hiding this comment

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

sqlalchemy 안쓰는걸로 알고 있는데.... 요건 뭔가요?

def __init__(self, db: Session):
self.db = db

def get(self, notification_id: int) -> Notification:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
def get(self, notification_id: int) -> Notification:
def get_by_id(self, notification_id: int) -> Notification:

함수이름은 파라미터를 보지 않아도 딱봐도 알 수 있게 작성하는게 좋아요 👍

self.db.add(notification)
self.db.commit()

def get_notifications_for_user(self, user: User) -> List[Notification]:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
def get_notifications_for_user(self, user: User) -> List[Notification]:
def get_notifications_by_user(self, user: User) -> List[Notification]:

self.db.commit()

def get_notifications_for_user(self, user: User) -> List[Notification]:
notifications = self.db.query(Notification).filter(Notification.user_id == user.id).all()
Copy link
Contributor

Choose a reason for hiding this comment

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

ORM 사용해야 합니다..


def get_notifications_for_user(self, user: User) -> List[Notification]:
notifications = self.db.query(Notification).filter(Notification.user_id == user.id).all()
return notifications
Copy link
Contributor

Choose a reason for hiding this comment

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

파일 끝에 엔터로 끝내주세요!!
@injoonH 요거 우리 precommit에서 체크 안하나요?

Copy link
Member

Choose a reason for hiding this comment

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

EditorConfig가 돌고 있을 텐데 이상하네요 👀

elif article.name_type == NameType.REGULAR:
return profile.nickname
else:
return "익명"
Copy link
Contributor

Choose a reason for hiding this comment

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

이런 상수는 constant.py에다가 넣어서 작성해 주세요 나중에 못찾습니다!

Comment on lines +8 to +10
from ara.domain.article import Article # Import Article and UserProfile from appropriate paths
from ara.domain.user_profile import UserProfile
from ara.domain.comment import Comment
Copy link
Contributor

Choose a reason for hiding this comment

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

이거 domain이 안보이는데...github branch 꼬인거 같아요

@injoonH injoonH deleted the branch base_refactoring April 28, 2024 05:32
@injoonH injoonH closed this Apr 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants