Wishlist‐ Class UML & API Endpoints - FEUP-MEIC-DS-2025-26/madeinportugal.store GitHub Wiki
Class UML
API — Endpoints
GET /api/wishlist?buyerId={buyerId}
Description: Returns the products in the wishlist for the specified user (`buyerId`).
Parameters:
buyerId (number) - ID of the user/buyer.
Response:
200 OK: Array of Product objects (products in the wishlist).
400 Bad Request: If `buyerId` is not provided.
POST /api/wishlist/add?buyerId={buyerId}&productId={productId}
Description: Adds a product to the buyer's wishlist.
Parameters (query): buyerId, productId
Response:
200 OK: The created WishlistItem object.
400 Bad Request: If buyerId or productId is missing.
500 Internal Server Error: Unexpected server error.
DELETE /api/wishlist/remove?buyerId={buyerId}&productId={productId}
Description: Removes a product from the buyer's wishlist.
Parameters (query): buyerId, productId
Response:
200 OK: { success: true }
400 Bad Request: If buyerId or productId is missing.
500 Internal Server Error: Unexpected server error.
Example objects
Example Product Object
{
"id": 42,
"external_id": 98765,
"product_name": "Traditional Pastel de Nata",
"description": "Traditional Portuguese pastry, flaky dough and creamy filling.",
"price": 1.5,
"discount": 0,
"stock": 200,
"stock_unlimited": false,
"sku": "PN-001",
"brand": "Pastelaria Central",
"status": "available",
"permalink": "https://example.com/products/42",
"image_url": "https://example.com/images/pastel.jpg"
}
Example WishlistItem Object
{
"id": 7,
"buyer_id": 3,
"product_id": 42,
"created_at": "2025-11-03T12:34:56.000Z"
}