banatie-service/apps/api-service
Oleg Proskurin 4785d23179 feat: implement Phase 4 image management with upload and CRUD endpoints
Implement complete image management system with file upload, listing, retrieval,
updates, alias assignment, and soft deletion.

**v1 API Routes:**
- `POST /api/v1/images/upload` - Upload single image file with database record
- `GET /api/v1/images` - List images with filters and pagination
- `GET /api/v1/images/:id` - Get single image by ID
- `PUT /api/v1/images/:id` - Update image metadata (alias, focal point, meta)
- `PUT /api/v1/images/:id/alias` - Assign project-scoped alias to image
- `DELETE /api/v1/images/:id` - Soft delete image

**Upload Endpoint Features:**
- Uses uploadSingleImage middleware for file handling
- Creates database record with image metadata
- Stores file in MinIO storage (uploads category)
- Supports optional alias and flowId parameters
- Returns ImageResponse with all metadata

**Route Features:**
- Authentication via validateApiKey middleware
- Project key requirement
- Rate limiting on upload endpoint
- Request validation with pagination
- Error handling with proper status codes
- Response transformation with toImageResponse converter
- Project ownership verification for all operations

**ImageService Integration:**
- Uses existing ImageService methods
- Supports filtering by flowId, source, alias
- Soft delete with deletedAt timestamp
- Alias validation and conflict detection

**Type Updates:**
- Updated ImageFilters with explicit | undefined for optional properties
- All response types already defined in responses.ts

**Technical Notes:**
- Upload creates both storage record and database entry atomically
- Focal point stored as JSON with x/y coordinates
- Meta field for flexible metadata storage
- File hash set to null (TODO: implement hashing)
- All Phase 4 code is fully type-safe with zero TypeScript errors

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-09 22:41:59 +07:00
..
_tests chore: update docs 2025-10-12 22:19:10 +07:00
src feat: implement Phase 4 image management with upload and CRUD endpoints 2025-11-09 22:41:59 +07:00
.env feat: update setup 2025-10-12 21:12:58 +07:00
.prettier.config.js chore: prettier 2025-10-09 23:16:42 +07:00
Dockerfile feat: update setup 2025-10-12 21:12:58 +07:00
NETWORK_ERROR_DETECTION.md feat: detect network issues 2025-10-10 00:17:29 +07:00
docker-compose.yml feat: update config 2025-10-12 21:49:42 +07:00
eslint.config.js chore: prettier 2025-10-09 23:16:42 +07:00
package.json feat: add Phase 1 foundation for API v2.0 2025-11-09 21:53:50 +07:00
secrets.env.example feat: update setup 2025-10-12 21:12:58 +07:00
test-network-error-detector.ts feat: detect network issues 2025-10-10 00:17:29 +07:00
tsconfig.json chore: prettier 2025-10-09 23:16:42 +07:00