-
Notifications
You must be signed in to change notification settings - Fork 1
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
Conversation
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.
이거 제가 올린 board 쪽 refactoring PR 봐주세요
이해가 안가는 부분은 Slack에 멘션 주세요!
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 |
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.
해당 파일은 ara/controller/notification/notification_controller.py
로 빼주세요
@@ -0,0 +1,24 @@ | |||
from fastapi import HTTPException |
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.
해당 파일 도 경로가 틀렸습니다 제가 올린 board refactoring PR 봐주세요
@@ -0,0 +1,24 @@ | |||
from fastapi import HTTPException | |||
from sqlalchemy.orm import Session |
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.
sqlalchemy 안쓰는걸로 알고 있는데.... 요건 뭔가요?
def __init__(self, db: Session): | ||
self.db = db | ||
|
||
def get(self, notification_id: int) -> Notification: |
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.
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]: |
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.
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() |
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.
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 |
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.
파일 끝에 엔터로 끝내주세요!!
@injoonH 요거 우리 precommit에서 체크 안하나요?
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.
EditorConfig가 돌고 있을 텐데 이상하네요 👀
elif article.name_type == NameType.REGULAR: | ||
return profile.nickname | ||
else: | ||
return "익명" |
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.
이런 상수는 constant.py에다가 넣어서 작성해 주세요 나중에 못찾습니다!
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 |
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.
이거 domain이 안보이는데...github branch 꼬인거 같아요
7442a29
to
3f00b35
Compare
Create notification FastAPI