AthletiFi / athletifi-website

Official website for AthletiFi
https://www.athleti.fi
1 stars 5 forks source link

Referral feature: Backend (AWS) - Invite a Friend #239

Closed qisforq closed 2 weeks ago

qisforq commented 2 months ago

Objective:

Develop Lambda functions to handle retrieving the user's cards and the invitation process, and set up the necessary API Gateway endpoints.

Sub-tasks:

  1. Create a Lambda function to retrieve the list of cards owned by a user to be displayed in the My Cards (profile) screen.
    • The Lambda function should receive the user_id as a parameter.
    • Query the player_card_images table to retrieve all records where the owner is set to the provided user_id (from the users table).
    • Return the list of cards owned by the user as a response.
  2. Set up an API Gateway endpoint that triggers the Lambda function for retrieving the user's cards.
  3. Create another Lambda function to handle the invitation process.
    • The Lambda function should be triggered when the 'Invite' button is clicked on the frontend (#238).
    • It should receive the inputted email address, card_id for the selected card, and the user_id of the inviting user.
    • Create a record in the invitations table with the received data, setting the status to 'pending'.
    • Generate a unique registration link for the invited guest, possibly using theinvite_id from the invitations table.
    • Send an email using SES to the invited guest with the unique registration link.
  4. Set up an API Gateway endpoint that triggers the Lambda function for sending invitations.
  5. Extend the existing Lambda function triggered by user registration via Cognito to handle invited guests.
    • Update the 'status' in the invitations table to 'accepted' and add the user_id of the newly registered guest to the guest column.

Image

qisforq commented 1 month ago

So far we have successfully passed down the invite_id query parameter, and persist it in local storage, and pass it back up to the writeUserData lambda function.

TODO:

qisforq commented 1 month ago

All tasks complete!