This document outlines the API endpoints and requirements for the frontend application.
- Endpoint:
/api/cart/sse/:sessionId
- Method:
GET
- Description: Retrieves the cart data for a specific session using Server-Sent Events (SSE).
- Parameters:
sessionId
: The ID of the session.
- Response: The cart data for the specified session.
- Endpoint:
/api/cart/add
- Method:
POST
- Description: Adds items to the cart for a specific session.
- Request Body:
sessionId
: The ID of the session.items
: An array of items to add to the cart.- Each item should contain:
id
: The item ID.quantity
: The quantity of the item to add.
- Each item should contain:
- Response: The updated cart data for the specified session.
- Endpoint:
/api/cart/delete
- Method:
POST
- Description: Deletes or decreases the quantity of items from the cart for a specific session.
- Request Body:
sessionId
: The ID of the session.items
: An array of items to delete or decrease from the cart.- Each item should contain:
id
: The item ID.quantity
: The quantity to delete or a negative number to decrease.
- Each item should contain:
- Response: The updated cart data for the specified session.
- Endpoint:
/api/cart/seatPurchase
- Method:
POST
- Description: Processes a seat purchase for a specific session.
- Request Body:
sessionId
: The ID of the session.quantity
: The quantity of seats to purchase.description
: The description of the seats.
- Response: The updated cart data for the specified session.
- Endpoint:
/api/cart/seatUpgrade
- Method:
POST
- Description: Processes a seat upgrade for a specific session.
- Request Body:
sessionId
: The ID of the session.quantity
: The number of seats to upgrade.
- Response: The updated cart data for the specified session.
- Endpoint:
/api/show-web
- Method:
POST
- Description: Triggers a web popup for all connected clients.
- Request Body:
url
: The URL to display in the popup.
- Response: A success message.
- Endpoint:
/events
- Method:
GET
- Description: Sets up Server-Sent Events (SSE) for the application.
- Response: The SSE event stream.
- The frontend application should send requests to the API endpoints with the required parameters and request bodies.
- The frontend application should handle the responses from the API endpoints and update the application state accordingly.
- The frontend application should use the
sessionId
parameter to identify the session and retrieve the corresponding cart data. - The frontend application should use the
Items
parameter to add, delete, or decrease the quantity of items in the cart. - The frontend application should use the
quantity
anddescription
parameters to process seat purchases and upgrades.