AthletiFi / athletifi-website

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

Referral feature: Backend (AWS) - Revoke Access #242

Closed qisforq closed 2 weeks ago

qisforq commented 2 months ago

Objective:

Develop Lambda functions to handle retrieving the list of invited guests, the list of cards the user has been invited to view, and the revocation of access for invited guests. Set up the necessary API Gateway endpoints.

Sub-tasks:

  1. Create a Lambda function to retrieve the list of guests invited to view the user's cards.
    • The Lambda function should receive the user_id as a parameter.
    • Query the player_card_images table to get all card_ids owned by the user.
    • Filter the invitations table by the obtained card_ids and where the status is not 'revoked'.
    • Return the list of guests, including their name, email, and the card they were invited to view.
  2. Set up an API Gateway endpoint that triggers the Lambda function for retrieving the list of invited guests.
  3. Create another Lambda function to retrieve the list of cards the user has been invited to view as a guest.
    • The Lambda function should receive the user_id as a parameter.
    • Filter the invitations table by the user_id as the guest and where the status is not 'revoked'.
    • Return the list of cards, including the card details and the owner's name.
  4. Set up an API Gateway endpoint that triggers the Lambda function for retrieving the list of cards the user has been invited to view.
  5. Create a Lambda function to handle the revocation of access for invited guests.
    • The Lambda function should be triggered when the 'Revoke Access' or 'Remove Myself' button is clicked on the frontend.
    • It should receive the invite_id of the invitation to be revoked.
    • Update the status of the corresponding record in the invitations table from 'accepted' to 'revoked'.
    • Send an email using SES to both the guest and the owner, notifying them of the revoked access.
  6. Set up an API Gateway endpoint that triggers the Lambda function for revoking access.

    Image