Fix when no reviews exist raises error
This commit is contained in:
@@ -13,7 +13,7 @@ async def list_reviews():
|
||||
with get_connection() as conn:
|
||||
reviews = conn.execute("SELECT * FROM Review").fetchdf()
|
||||
if reviews.empty:
|
||||
raise HTTPException(status_code=404, detail="Reviews not found")
|
||||
return []
|
||||
return reviews.to_dict(orient="records")
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ async def get_review(song_id: int, user_id: int):
|
||||
(song_id, user_id),
|
||||
).fetchdf()
|
||||
if review.empty:
|
||||
raise HTTPException(status_code=404, detail="Review not found")
|
||||
return []
|
||||
return review.to_dict(orient="records")[0]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user