Skip to content

Commit

Permalink
update request to include request detail
Browse files Browse the repository at this point in the history
  • Loading branch information
Ferrariic committed Mar 17, 2023
1 parent e674557 commit 72f1a12
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion api/routers/v1/request/requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,13 @@ async def get_pending_requests(token: str) -> json:
data_pack = [tuple((token, u_id)) for u_id in user_ids]
future_list = await batch_function(get_profile_details, data=data_pack)

return HTTPException(status_code=status.HTTP_200_OK, detail=future_list)
combination = list(zip(future_list, data))
result = []
for fl, d in combination:
d["user_information"] = fl
result.append(d)

return HTTPException(status_code=status.HTTP_200_OK, detail=result)


@router.get("/get-accepted/{token}", tags=["requests"])
Expand All @@ -143,6 +149,12 @@ async def get_accepted_requests(token: str) -> json:
data_pack = [tuple((token, u_id)) for u_id in user_ids]
future_list = await batch_function(get_profile_details, data=data_pack)

combination = list(zip(future_list, data))
result = []
for fl, d in combination:
d["user_information"] = fl
result.append(d)

return HTTPException(status_code=status.HTTP_200_OK, detail=future_list)


Expand Down Expand Up @@ -170,6 +182,12 @@ async def get_denied_requests(token: str) -> json:
data_pack = [tuple((token, u_id)) for u_id in user_ids]
future_list = await batch_function(get_profile_details, data=data_pack)

combination = list(zip(future_list, data))
result = []
for fl, d in combination:
d["user_information"] = fl
result.append(d)

return HTTPException(status_code=status.HTTP_200_OK, detail=future_list)


Expand All @@ -195,6 +213,12 @@ async def get_all_requests(token: str) -> json:
data_pack = [tuple((token, u_id)) for u_id in user_ids]
future_list = await batch_function(get_profile_details, data=data_pack)

combination = list(zip(future_list, data))
result = []
for fl, d in combination:
d["user_information"] = fl
result.append(d)

return HTTPException(status_code=status.HTTP_200_OK, detail=future_list)


Expand All @@ -220,6 +244,12 @@ async def get_sent_requests(token: str) -> json:
data_pack = [tuple((token, u_id)) for u_id in user_ids]
future_list = await batch_function(get_profile_details, data=data_pack)

combination = list(zip(future_list, data))
result = []
for fl, d in combination:
d["user_information"] = fl
result.append(d)

return HTTPException(status_code=status.HTTP_200_OK, detail=future_list)


Expand Down

0 comments on commit 72f1a12

Please sign in to comment.