the-tip-top-backend/postman-collection.json
2025-11-17 23:47:54 +01:00

888 lines
24 KiB
JSON

{
"info": {
"name": "The Tip Top API",
"_postman_id": "thetiptop-api-v1",
"description": "Collection complète des APIs The Tip Top",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"variable": [
{
"key": "base_url",
"value": "http://localhost:4000",
"type": "string"
},
{
"key": "token",
"value": "",
"type": "string"
}
],
"item": [
{
"name": "🔓 1. Routes Publiques",
"item": [
{
"name": "Health Check",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/",
"host": ["{{base_url}}"],
"path": [""]
}
}
},
{
"name": "Database Check",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/db-check",
"host": ["{{base_url}}"],
"path": ["db-check"]
}
}
},
{
"name": "Metrics Prometheus",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/metrics",
"host": ["{{base_url}}"],
"path": ["metrics"]
}
}
}
]
},
{
"name": "🔐 2. Authentification",
"item": [
{
"name": "Inscription",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"email\": \"nouveau@test.com\",\n \"password\": \"Password123\",\n \"confirmPassword\": \"Password123\",\n \"firstName\": \"John\",\n \"lastName\": \"Doe\",\n \"phone\": \"0612345678\",\n \"address\": \"1 rue de Paris\",\n \"city\": \"Paris\",\n \"postalCode\": \"75001\"\n}"
},
"url": {
"raw": "{{base_url}}/api/auth/register",
"host": ["{{base_url}}"],
"path": ["api", "auth", "register"]
}
}
},
{
"name": "Connexion CLIENT",
"event": [
{
"listen": "test",
"script": {
"exec": [
"if (pm.response.code === 200) {",
" var jsonData = pm.response.json();",
" pm.environment.set(\"token\", jsonData.token);",
" console.log(\"Token saved:\", jsonData.token);",
"}"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"email\": \"test-client@test.com\",\n \"password\": \"Test1234\"\n}"
},
"url": {
"raw": "{{base_url}}/api/auth/login",
"host": ["{{base_url}}"],
"path": ["api", "auth", "login"]
}
}
},
{
"name": "Connexion EMPLOYEE",
"event": [
{
"listen": "test",
"script": {
"exec": [
"if (pm.response.code === 200) {",
" var jsonData = pm.response.json();",
" pm.environment.set(\"token\", jsonData.token);",
"}"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"email\": \"employee@test.com\",\n \"password\": \"Employee1234\"\n}"
},
"url": {
"raw": "{{base_url}}/api/auth/login",
"host": ["{{base_url}}"],
"path": ["api", "auth", "login"]
}
}
},
{
"name": "Connexion ADMIN",
"event": [
{
"listen": "test",
"script": {
"exec": [
"if (pm.response.code === 200) {",
" var jsonData = pm.response.json();",
" pm.environment.set(\"token\", jsonData.token);",
"}"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"email\": \"admin@test.com\",\n \"password\": \"Admin1234\"\n}"
},
"url": {
"raw": "{{base_url}}/api/auth/login",
"host": ["{{base_url}}"],
"path": ["api", "auth", "login"]
}
}
},
{
"name": "Vérifier Email",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/api/auth/verify-email/:token",
"host": ["{{base_url}}"],
"path": ["api", "auth", "verify-email", ":token"],
"variable": [
{
"key": "token",
"value": "your-verification-token"
}
]
}
}
},
{
"name": "Mot de passe oublié",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"email\": \"test-client@test.com\"\n}"
},
"url": {
"raw": "{{base_url}}/api/auth/forgot-password",
"host": ["{{base_url}}"],
"path": ["api", "auth", "forgot-password"]
}
}
},
{
"name": "Réinitialiser mot de passe",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"token\": \"reset-token-from-email\",\n \"password\": \"NewPassword123\",\n \"confirmPassword\": \"NewPassword123\"\n}"
},
"url": {
"raw": "{{base_url}}/api/auth/reset-password",
"host": ["{{base_url}}"],
"path": ["api", "auth", "reset-password"]
}
}
}
]
},
{
"name": "👤 3. Utilisateur",
"item": [
{
"name": "Mon profil",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{token}}",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/api/users/profile",
"host": ["{{base_url}}"],
"path": ["api", "users", "profile"]
}
}
},
{
"name": "Modifier profil",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{token}}",
"type": "string"
}
]
},
"method": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"firstName\": \"Jean\",\n \"lastName\": \"Dupont\",\n \"phone\": \"0698765432\"\n}"
},
"url": {
"raw": "{{base_url}}/api/users/profile",
"host": ["{{base_url}}"],
"path": ["api", "users", "profile"]
}
}
},
{
"name": "Changer mot de passe",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{token}}",
"type": "string"
}
]
},
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"currentPassword\": \"Test1234\",\n \"newPassword\": \"NewPassword123\",\n \"confirmPassword\": \"NewPassword123\"\n}"
},
"url": {
"raw": "{{base_url}}/api/users/change-password",
"host": ["{{base_url}}"],
"path": ["api", "users", "change-password"]
}
}
}
]
},
{
"name": "🎮 4. Jeu",
"item": [
{
"name": "Jouer (CLIENT uniquement)",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{token}}",
"type": "string"
}
]
},
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"ticketCode\": \"ABC-DEFG-HIJK\"\n}"
},
"url": {
"raw": "{{base_url}}/api/game/play",
"host": ["{{base_url}}"],
"path": ["api", "game", "play"]
}
}
},
{
"name": "Mes tickets",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{token}}",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/api/game/my-tickets?page=1&limit=10",
"host": ["{{base_url}}"],
"path": ["api", "game", "my-tickets"],
"query": [
{
"key": "page",
"value": "1"
},
{
"key": "limit",
"value": "10"
},
{
"key": "status",
"value": "PENDING",
"disabled": true
}
]
}
}
},
{
"name": "Ticket par ID",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{token}}",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/api/game/my-tickets/:id",
"host": ["{{base_url}}"],
"path": ["api", "game", "my-tickets", ":id"],
"variable": [
{
"key": "id",
"value": "ticket-uuid"
}
]
}
}
},
{
"name": "Ticket par code",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{token}}",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/api/game/ticket/:code",
"host": ["{{base_url}}"],
"path": ["api", "game", "ticket", ":code"],
"variable": [
{
"key": "code",
"value": "ABC-DEFG-HIJK"
}
]
}
}
}
]
},
{
"name": "👔 5. Employé",
"item": [
{
"name": "Tickets en attente",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{token}}",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/api/employee/pending-tickets?page=1&limit=10",
"host": ["{{base_url}}"],
"path": ["api", "employee", "pending-tickets"],
"query": [
{
"key": "page",
"value": "1"
},
{
"key": "limit",
"value": "10"
}
]
}
}
},
{
"name": "Valider ticket",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{token}}",
"type": "string"
}
]
},
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"ticketId\": \"ticket-uuid\",\n \"action\": \"validate\"\n}"
},
"url": {
"raw": "{{base_url}}/api/employee/validate-ticket",
"host": ["{{base_url}}"],
"path": ["api", "employee", "validate-ticket"]
}
}
},
{
"name": "Rejeter ticket",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{token}}",
"type": "string"
}
]
},
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"ticketId\": \"ticket-uuid\",\n \"action\": \"reject\",\n \"rejectionReason\": \"Ticket non conforme\"\n}"
},
"url": {
"raw": "{{base_url}}/api/employee/validate-ticket",
"host": ["{{base_url}}"],
"path": ["api", "employee", "validate-ticket"]
}
}
}
]
},
{
"name": "👑 6. Admin",
"item": [
{
"name": "Statistiques",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{token}}",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/api/admin/statistics",
"host": ["{{base_url}}"],
"path": ["api", "admin", "statistics"]
}
}
},
{
"name": "Liste des prix",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{token}}",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/api/admin/prizes",
"host": ["{{base_url}}"],
"path": ["api", "admin", "prizes"]
}
}
},
{
"name": "Créer prix",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{token}}",
"type": "string"
}
]
},
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"type\": \"PHYSICAL\",\n \"name\": \"Coffret découverte\",\n \"description\": \"Assortiment de thés premium\",\n \"value\": \"69.00\",\n \"probability\": 0.15,\n \"stock\": 200\n}"
},
"url": {
"raw": "{{base_url}}/api/admin/prizes",
"host": ["{{base_url}}"],
"path": ["api", "admin", "prizes"]
}
}
},
{
"name": "Modifier prix",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{token}}",
"type": "string"
}
]
},
"method": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"name\": \"Nouveau nom\",\n \"stock\": 250\n}"
},
"url": {
"raw": "{{base_url}}/api/admin/prizes/:id",
"host": ["{{base_url}}"],
"path": ["api", "admin", "prizes", ":id"],
"variable": [
{
"key": "id",
"value": "prize-uuid"
}
]
}
}
},
{
"name": "Supprimer prix",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{token}}",
"type": "string"
}
]
},
"method": "DELETE",
"header": [],
"url": {
"raw": "{{base_url}}/api/admin/prizes/:id",
"host": ["{{base_url}}"],
"path": ["api", "admin", "prizes", ":id"],
"variable": [
{
"key": "id",
"value": "prize-uuid"
}
]
}
}
},
{
"name": "Liste utilisateurs",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{token}}",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/api/admin/users?page=1&limit=20",
"host": ["{{base_url}}"],
"path": ["api", "admin", "users"],
"query": [
{
"key": "page",
"value": "1"
},
{
"key": "limit",
"value": "20"
},
{
"key": "role",
"value": "CLIENT",
"disabled": true
}
]
}
}
},
{
"name": "Créer employé",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{token}}",
"type": "string"
}
]
},
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"email\": \"employee@thetiptop.com\",\n \"password\": \"TempPassword123\",\n \"firstName\": \"Marie\",\n \"lastName\": \"Dupont\"\n}"
},
"url": {
"raw": "{{base_url}}/api/admin/employees",
"host": ["{{base_url}}"],
"path": ["api", "admin", "employees"]
}
}
},
{
"name": "Modifier utilisateur",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{token}}",
"type": "string"
}
]
},
"method": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"role\": \"EMPLOYEE\",\n \"isVerified\": true\n}"
},
"url": {
"raw": "{{base_url}}/api/admin/users/:id",
"host": ["{{base_url}}"],
"path": ["api", "admin", "users", ":id"],
"variable": [
{
"key": "id",
"value": "user-uuid"
}
]
}
}
},
{
"name": "Supprimer utilisateur",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{token}}",
"type": "string"
}
]
},
"method": "DELETE",
"header": [],
"url": {
"raw": "{{base_url}}/api/admin/users/:id",
"host": ["{{base_url}}"],
"path": ["api", "admin", "users", ":id"],
"variable": [
{
"key": "id",
"value": "user-uuid"
}
]
}
}
},
{
"name": "Liste tous les tickets",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{token}}",
"type": "string"
}
]
},
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/api/admin/tickets?page=1&limit=20",
"host": ["{{base_url}}"],
"path": ["api", "admin", "tickets"],
"query": [
{
"key": "page",
"value": "1"
},
{
"key": "limit",
"value": "20"
},
{
"key": "status",
"value": "PENDING",
"disabled": true
}
]
}
}
}
]
}
]
}