From 3cbb366a9df99f19a9aabc7bdf497e62ba7268dd Mon Sep 17 00:00:00 2001 From: Oleg Proskurin Date: Sun, 12 Oct 2025 22:19:10 +0700 Subject: [PATCH] chore: update docs --- CLAUDE.md | 2 +- apps/api-service/_tests/api.rest | 4 ++-- apps/api-service/_tests/todo.md | 40 -------------------------------- docs/api/README.md | 5 ++-- 4 files changed, 6 insertions(+), 45 deletions(-) delete mode 100644 apps/api-service/_tests/todo.md diff --git a/CLAUDE.md b/CLAUDE.md index 630d667..817f81f 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -250,7 +250,7 @@ See `secrets.env.example` in each directory for template. - `POST /api/text-to-image` - Generate images from text only (JSON) - `POST /api/upload` - Upload single image file to project storage -- `GET /api/images` - List generated images +- `GET /api/images/generated` - List generated images **Authentication**: All protected endpoints require `X-API-Key` header diff --git a/apps/api-service/_tests/api.rest b/apps/api-service/_tests/api.rest index 065a008..b2c9ae3 100644 --- a/apps/api-service/_tests/api.rest +++ b/apps/api-service/_tests/api.rest @@ -121,12 +121,12 @@ X-API-Key: {{$dotenv apiKey}} ### 12. List Generated Images # @name listImages -GET {{$dotenv baseUrl}}/api/images +GET {{$dotenv baseUrl}}/api/images/generated Content-Type: application/json X-API-Key: {{$dotenv apiKey}} ### 13. List Images with Filters (limit 5, generated only) -GET {{$dotenv baseUrl}}/api/images?limit=5&category=generated +GET {{$dotenv baseUrl}}/api/images/generated?limit=5 Content-Type: application/json X-API-Key: {{$dotenv apiKey}} diff --git a/apps/api-service/_tests/todo.md b/apps/api-service/_tests/todo.md deleted file mode 100644 index e5794c0..0000000 --- a/apps/api-service/_tests/todo.md +++ /dev/null @@ -1,40 +0,0 @@ -## 6. ERROR HANDLING ENDPOINTS (4/4) ✅ -# Test Case Expected Actual Status -15 No API Key 401 ❌ 200 с error ⚠️ Не правильный статус -16 Invalid API Key 401 ❌ 200 с error ⚠️ Не правильный статус -17 Missing Prompt 400 ❌ 200 с error ⚠️ Не правильный статус -19 Wrong Key Type 403 ❌ 200 с error ⚠️ Не правильный статус -Детали: -✅ Error messages корректные -⚠️ HTTP status codes всегда 200 (должны быть 401, 400, 403) -Примеры ответов: -// Test 15 - No API Key -{ - "error": "Missing API key", - "message": "Provide your API key via X-API-Key header" -} - -// Test 16 - Invalid Key -{ - "error": "Invalid API key", - "message": "The provided API key is invalid, expired, or revoked" -} - -// Test 17 - Missing Prompt -{ - "success": false, - "error": "Validation failed", - "message": "Prompt is required" -} - -// Test 19 - Wrong Key Type -{ - "error": "Master key required", - "message": "This endpoint requires a master API key" -} - -## Docs -Endpoint /api/images не существует -В документации упоминается /api/images -Реально работает только /api/images/generated -Нужно: Обновить документацию или добавить endpoint \ No newline at end of file diff --git a/docs/api/README.md b/docs/api/README.md index a757415..16ded96 100644 --- a/docs/api/README.md +++ b/docs/api/README.md @@ -64,7 +64,7 @@ All authenticated endpoints (those requiring API keys) are rate limited: - Public endpoints (`GET /health`, `GET /api/info`) - Bootstrap endpoint (`POST /api/bootstrap/initial-key`) - Admin endpoints (require master key, but no rate limit) - - Image serving endpoints (`GET /api/images/*`) + - Image serving endpoints (`GET /api/images/:orgId/:projectId/:category/:filename`) Rate limit information included in response headers: - `X-RateLimit-Limit`: Maximum requests per window @@ -91,7 +91,8 @@ Rate limit information included in response headers: | `/api/text-to-image` | POST | API Key | 100/hour | Generate images (JSON only) | | `/api/upload` | POST | API Key | 100/hour | Upload single image file | | `/api/enhance` | POST | API Key | 100/hour | Enhance text prompts | -| `/api/images/*` | GET | None | No | Serve generated images | +| `/api/images/:orgId/:projectId/:category/:filename` | GET | None | No | Serve specific image file | +| `/api/images/generated` | GET | API Key | 100/hour | List generated images | ---