Commit Graph

10 Commits

Author SHA1 Message Date
Oleg Proskurin 2c67dad9c2 feat: implement Phase 2 core generation flow with services and endpoints
Implement the complete image generation lifecycle with ImageService, GenerationService,
and v1 API endpoints. This enables end-to-end generation with alias support and flow management.

**Core Services:**
- **ImageService**: Full CRUD for images table
  - Create/read/update/delete operations
  - Soft delete support with deletedAt
  - Project and flow alias assignment
  - Storage key and file hash tracking
  - Pagination and filtering

- **GenerationService**: Complete generation lifecycle orchestration
  - Create generation records with pending status
  - Resolve reference images via AliasService
  - Call ImageGenService for AI generation
  - Create image records in database
  - Link images to generations
  - Update generation status (processing → success/failed)
  - Support for flow association and alias assignment
  - Retry failed generations
  - Soft/hard delete operations

**v1 API Routes:**
- `POST /api/v1/generations` - Create with references & aliases
- `GET /api/v1/generations` - List with filters & pagination
- `GET /api/v1/generations/:id` - Get with full relations
- `POST /api/v1/generations/:id/retry` - Retry failed generation
- `DELETE /api/v1/generations/:id` - Delete generation & output

**Route Features:**
- Authentication via validateApiKey middleware
- Project key requirement
- Rate limiting per API key
- Request validation with pagination
- Error handling with proper status codes
- Response transformation with type converters

**Type Updates:**
- Add explicit undefined to optional properties for exactOptionalPropertyTypes
- CreateGenerationParams interface for service layer
- GenerationFilters with proper optionals

**Infrastructure:**
- Mount v1Router at /api/v1 in app.ts
- Keep legacy routes for backward compatibility
- Versioned API structure for future iterations

**Technical Notes:**
- Reference image download temporarily skipped (TODO: storage key parsing)
- File hash computation temporarily disabled (TODO: helper method)
- File size set to 0 (TODO: get from storage)
- All Phase 2 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:14:49 +07:00
Oleg Proskurin 237443194f feat: add file upload endpoint 2025-10-11 00:08:51 +07:00
Oleg Proskurin 83303f8890 feat: remove unused endpoints 2025-10-09 23:48:25 +07:00
Oleg Proskurin df6596d53c chore: prettier 2025-10-09 23:16:42 +07:00
Oleg Proskurin 63aa812f5e chore: prettify 2025-10-07 22:05:00 +07:00
Oleg Proskurin 97502ddae1 fix: demo page inlanding 2025-10-05 19:41:04 +07:00
Oleg Proskurin 91ba71cc23 fix: image paths 2025-10-04 01:42:58 +07:00
Oleg Proskurin 960183c9c4 fix: CORS settings 2025-10-04 01:29:59 +07:00
Oleg Proskurin 298898f79d feat: implement apikey auth 2025-10-01 00:14:14 +07:00
Oleg Proskurin babcbe29db feat: move to monorepo 2025-09-29 21:58:43 +07:00