banatie-service/apps/api-service
Oleg Proskurin 9b9c47e2bf feat: phase 2 part 1 - schema changes, regeneration, and lazy flows
**Database Schema Changes (Section 2.1):**
- Rename generations.enhancedPrompt → generations.prompt (prompt used for generation)
- Rename generations.originalPrompt semantics → user's original (only if enhanced)
- Reverse semantics: prompt = what was used, originalPrompt = preserved user input
- Add projects.allowNewLiveScopes (BOOLEAN, default: true)
- Add projects.newLiveScopesGenerationLimit (INTEGER, default: 30)

**Prompt Semantics Update:**
- If autoEnhance=false: prompt=user input, originalPrompt=null
- If autoEnhance=true: prompt=enhanced, originalPrompt=user input
- Updated GenerationService.create() to implement new logic
- Updated retry() and update() methods to use new prompt field

**Regeneration Refactoring (Section 3):**
- Add POST /api/v1/generations/:id/regenerate endpoint
- Remove status checks (allow regeneration for any status)
- Remove retry count logic (no longer tracked)
- Remove parameter overrides (uses exact same params as original)
- Updates existing image (same imageId, storageKey, storageUrl)
- Keep /retry endpoint for backward compatibility (delegates to regenerate)
- GenerationService.regenerate() method created
- Physical file in MinIO overwritten by ImageGenService

**Flow Regeneration (Section 3.6):**
- Add POST /api/v1/flows/:id/regenerate endpoint
- Regenerates most recent generation in flow
- Returns FLOW_HAS_NO_GENERATIONS error if flow is empty
- Uses parameters from last generation

**Lazy Flow Creation (Section 4.3):**
- Remove POST /api/v1/flows endpoint (commented out with explanation)
- Flows now created automatically when:
  - Generation/upload specifies a flowId
  - Generation/upload provides flowAlias (eager creation)
- Eager creation logic already implemented in Phase 1

**Technical Notes:**
- All Phase 2 Part 1 changes maintain data integrity
- No migration needed (dev mode per user confirmation)
- Regeneration preserves image metadata (alias, createdAt, etc.)
- Processing time tracked for regeneration

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 01:43:49 +07:00
..
_tests chore: update docs 2025-10-12 22:19:10 +07:00
src feat: phase 2 part 1 - schema changes, regeneration, and lazy flows 2025-11-17 01:43:49 +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