uchicago-cs / chigame

BSD 3-Clause "New" or "Revised" License
2 stars 0 forks source link

Creating API endpoint to send/accept friend requests #367

Open abrahmasandra opened 9 months ago

abrahmasandra commented 9 months ago

Summary:

In order for two users to become friends, one user needs to send a friend request to the other user. In ChiGame, this is handled specifically by the FriendInvitation model. A user can create a FriendInvitation and another user can then accept that invitation.

In this issue, we aim to allow a user to make a friend request from the API endpoint: /api/friend-invitations/send/ and accept a specific friend request at friend-invitations/accept/<int:pk>/' where the pk is the id of the specific request.

We will know when this issue is completed when these endpoints work as described above.

Esterello2 commented 9 months ago

I am creating API Endpoints that deal with handling POST requests for FriendInvitations; the first endpoint is done by first "Sending" a FriendInvitation object, which essentially creates one of these objects with the user pk of both sender and receiver. Then, another endpoint would deal with "Accepting" the invitation, which takes in the FriendInvitation pk, and changes the "accepted" attribute to True if done properly. Then, a ListView for GET requests of all Friend Invitations, pending and accepted.

Esterello2 commented 9 months ago

There seems to be an issue with one of the models (UserProfile query) which I am reaching out to the User/Friend team for