Skip to content

Commit

Permalink
fix: get the reported user by id
Browse files Browse the repository at this point in the history
  • Loading branch information
nahyun0121 committed Dec 3, 2023
1 parent cdc29bc commit 16f43dd
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions app/crud/crud_reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@
def create_report(
db: Session, reporter_id: int, report_in: ReportUser
) -> ReportResponse:
# Get the reported user by user name
reported_user = (
db.query(User).filter(User.username == report_in.reported_user_name).first()
)
# Get the reported user by user's id
reported_user = db.query(User).filter(User.id == report_in.reported_id).first()

if not reported_user:
raise HTTPException(status_code=400, detail="Reported user not found")
Expand Down

0 comments on commit 16f43dd

Please sign in to comment.