Endpoints - Orden-der-letzten-Haltestelle/WebEngineering GitHub Wiki

πŸ“ Enpoints

We have two different kinds of Roles. We have the webshop roles admin and user and also custome roles for wishlists: owner, write and read.

Usefull link for Routing using Express: Routing

πŸ“‹ Needed Endpoints

Action Endpoint Role Payload Description
GET /api/products?name={name}&minPrice={x}&maxPrice={y} user All products in Price Range and including the name
GET /api/product/:productId user Single product
POST /api/product admin πŸ“ Product Create a product (name, description, amount, price)
PUT /api/product/:productId admin πŸ“ Product Update a product (name, description, amount, price)
DELETE /api/product/:productId admin ❌ Delete a product
GET /api/cart user All products in own Cart
DELETE /api/cart user ❌ Delete all products of Cart
POST /api/cart/product/:productId?amount={amount} user πŸ–±οΈ Add product to Cart Amount is optional will be set on 1 if not given.
PUT /api/cart/item/:cartItemId?amount={amount} user πŸ“ Change amount of product in your cart
DELETE /api/cart/item/:cartItemId user ❌ Remove product from Cart
POST /api/cart/buy user πŸ–±οΈ Moves products of Cart into Order
GET /api/cart/orders user Shows all ordered products
GET /api/wishlist read All your Wishlists
GET /api/wishlist/:wishlistId read Single Wishlist (with all items in it)
POST /api/wishlist owner πŸ“ Wishlist Create a Wishlist
PUT /api/wishlist/:wishlistId write πŸ“ Wishlist Update Wishlist (name, desc.)
DELETE /api/wishlist/:wishlistId owner LΓΆscht eine Wunschliste
POST /api/wishlist/:wishlistId/item?productId={...} write πŸ–±οΈ Add a product to a Wishlist (amount = 1)
PUT /api/wishlist/item/:wishlistItemId?amount={amount} write πŸ“ Change amount of product
DELETE /api/wishlist/item/:wishlistItemId write ❌ Remove product from Wishlist
POST /api/wishlist/:wishlistId/permission owner πŸ“ WishlistMemeber Add a user to a selected Wishlist Payload hat userId und rollen des jeweiligen nutzers
PUT /api/wishlist/permission/:userWishlistRelationId owner πŸ“ Role Change role of a user
DELETE /api/wishlist/permission/:userWishlistRelationId owner ❌ Delete user from wishlist
POST /api/auth/register πŸ“ User Register a user
POST /api/auth/login user πŸ“ User Login of user
POST /api/auth/login?email={email} user πŸ“ Email Login with only Email and a Link to verify
GET /api/auth/renew user Erneuert den JWT token
POST /api/auth/logout user πŸ–±οΈ Logout of current user (einfach token lΓΆschen im frontend)
PUT /api/auth/verify?token={...} user verification with email
GET /api/user user Returns your User
GET /api/users?name={...} user Returns all Users gefiltert nach name
GET /api/user/:userId user Returns a single User
PUT /api/user/:userId/bann admin πŸ–±οΈ Banns the User
PUT /api/user/:userId/unbann admin πŸ–±οΈ Unbanns the User
PUT /api/user/:userId/role admin πŸ“ Role Change the Role of the User

Legend

Logo Description
πŸ“ Input via a Form
πŸ–±οΈ Input via a Button
❌ Deletion via a Button

🧾 Details for each Endpoints

will be implemented