feat: Semaine 8

This commit is contained in:
gauvainboiche
2026-05-11 09:25:19 +02:00
parent 606e43e53f
commit 3315cb2336
123 changed files with 5748 additions and 0 deletions
+149
View File
@@ -0,0 +1,149 @@
# ============================================================
# USERS
# ⚠ Les IDs sont en mémoire vive : ils repartent à 1 après
# chaque redémarrage des conteneurs. Exécuter dans l'ordre
# depuis un démarrage propre (docker compose up).
# ============================================================
### 1. Créer l'utilisateur Alice → reçoit id=1
# @name createAlice
POST http://localhost:8000/users
Content-Type: application/json
{"name": "Alice", "email": "alice@example.com"}
###
### 2. Créer l'utilisateur Bob → reçoit id=2
# @name createBob
POST http://localhost:8000/users
Content-Type: application/json
{"name": "Bob", "email": "bob@example.com"}
###
### 3. Récupérer Alice (id=1)
GET http://localhost:8000/users/1
###
### 4. Récupérer Bob (id=2)
GET http://localhost:8000/users/2
###
### Récupérer un utilisateur inexistant → 404
GET http://localhost:8000/users/99
###
# ============================================================
# PRODUCTS
# ============================================================
### Consulter le Laptop (id=1, stock initial=10)
GET http://localhost:8000/products/1
###
### Consulter le Smartphone (id=2, stock initial=20)
GET http://localhost:8000/products/2
###
### Consulter les Headphones (id=3, stock initial=15)
GET http://localhost:8000/products/3
###
### Soustraire 3 Laptops du stock
PUT http://localhost:8000/products/1/stock
Content-Type: application/json
{"quantity": 3}
###
### Vérifier le stock du Laptop après soustraction (attendu: 7)
GET http://localhost:8000/products/1
###
### Soustraire plus que le stock disponible → 400 Insufficient stock
PUT http://localhost:8000/products/1/stock
Content-Type: application/json
{"quantity": 999}
###
### Consulter un produit inexistant → 404
GET http://localhost:8000/products/99
###
# ============================================================
# ORDERS
# ============================================================
### Créer une commande: Alice achète 2 Smartphones
POST http://localhost:8000/orders
Content-Type: application/json
{"user_id": 1, "product_id": 2, "quantity": 2}
###
### Vérifier le stock du Smartphone après commande (attendu: 18)
GET http://localhost:8000/products/2
###
### Récupérer la commande (id=1)
GET http://localhost:8000/orders/1
###
### Créer une commande: Bob achète 1 Laptop
POST http://localhost:8000/orders
Content-Type: application/json
{"user_id": 2, "product_id": 1, "quantity": 1}
###
### Récupérer la commande de Bob (id=2)
GET http://localhost:8000/orders/2
###
### Commande avec utilisateur inexistant → 404
POST http://localhost:8000/orders
Content-Type: application/json
{"user_id": 99, "product_id": 1, "quantity": 1}
###
### Commande avec produit inexistant → 404
POST http://localhost:8000/orders
Content-Type: application/json
{"user_id": 1, "product_id": 99, "quantity": 1}
###
### Récupérer une commande inexistante → 404
GET http://localhost:8000/orders/99
###
# ============================================================
# HEALTH CHECKS
# ============================================================
### Health check api-gateway
GET http://localhost:8000/health
###