banatie-service/apps/api-service
Oleg Proskurin 85395084b7 feat: implement Phase 3 flow management with service and endpoints
Implement complete flow management system with CRUD operations, computed counts,
and alias management capabilities for organizing generation chains.

**Core Service:**
- **FlowService**: Complete flow lifecycle management
  - Create flows with initial empty aliases
  - CRUD operations (create, read, update, delete)
  - Computed counts for generations and images per flow
  - Alias management (add, update, remove)
  - Get flow's generations and images with pagination
  - No soft delete (flows use hard delete)

**v1 API Routes:**
- `POST /api/v1/flows` - Create new flow
- `GET /api/v1/flows` - List flows with pagination and counts
- `GET /api/v1/flows/:id` - Get single flow with computed counts
- `GET /api/v1/flows/:id/generations` - List flow's generations
- `GET /api/v1/flows/:id/images` - List flow's images
- `PUT /api/v1/flows/:id/aliases` - Update flow aliases (add/modify)
- `DELETE /api/v1/flows/:id/aliases/:alias` - Remove specific alias
- `DELETE /api/v1/flows/:id` - Delete flow (hard delete)

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

**Type Updates:**
- Added ListFlowGenerationsResponse and ListFlowImagesResponse
- Updated GetFlowResponse to return FlowResponse (not FlowWithDetailsResponse)
- FlowService methods return FlowWithCounts where appropriate

**Technical Notes:**
- Flows don't have deletedAt column (no soft delete support)
- All count queries filter active generations/images only
- Alias updates are merged with existing aliases
- Empty flows return generationCount: 0, imageCount: 0
- All Phase 3 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:24:40 +07:00
..
_tests chore: update docs 2025-10-12 22:19:10 +07:00
src feat: implement Phase 3 flow management with service and endpoints 2025-11-09 22:24:40 +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