Skip to content

Commit

Permalink
Merge pull request #249 from KMU-WINK/feat/177-check-item-in-wish
Browse files Browse the repository at this point in the history
hotfix:unloggedin google, inWish field
  • Loading branch information
hyeonseung-lee authored Oct 3, 2024
2 parents 5064373 + d8a74f9 commit 001ea01
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions backend/app/routers/google.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,9 @@ def sentence(request: Request):
async def main(
request: Request, region_idx: int, keyword_idx: int, db: Session = Depends(get_db)
):
current_user = get_current_user(request, db)
if current_user is None:
raise HTTPException(
status_code=400,
detail=f"user not found. request.header.Authorization: {request.headers.get('Authorization')}",
)
else:
wishs = []
if request.cookies.get("accessToken"):
current_user = get_current_user(request, db)
stay_wish = db.query(Stay).filter(Stay.user_id == current_user.id).all()
spot_wish = db.query(Spot).filter(Spot.user_id == current_user.id).all()
wishs = [wish.content_id for wish in stay_wish + spot_wish]
Expand Down Expand Up @@ -163,9 +159,8 @@ async def main(
result.append(tour_result[idx])

if len(result):
if wishs:
for item in result:
item["inWish"] = item["contentid"] in wishs
for item in result:
item["inWish"] = item["contentid"] in wishs
return result
else:
raise HTTPException(status_code=500, detail="No data found in google reccomend")

0 comments on commit 001ea01

Please sign in to comment.