juanatsap
9636b3659f
refactor: Extract all hardcoded content to JSON files
...
- Move all bilingual text from templates to UI JSON (labels, buttons, modals)
- Move skills summary paragraph to CV JSON with HTML support
- Add new UI sections: navigation, viewControls, sections, footer, portfolio,
pdfModal, shortcutsModal, infoModal, widgets
- Update Go structs to match expanded JSON structure
- Add template.HTML type for CV.SkillsSummary field
- Add JSON content validation test (70-json-content-validation.test.mjs)
Templates now contain only structural logic (CSS classes, HTML attributes)
while all user-visible text loads from JSON files for proper i18n support.
2025-11-30 10:13:37 +00:00
juanatsap
7b60fdcf9c
refactor: Separate CV domain and UI presentation models into distinct packages
...
**Main Changes:**
1. **Package Restructuring** - Separated mixed concerns into focused packages:
- Created `internal/models/cv/` for CV domain logic (CV, Personal, Experience, etc.)
- Created `internal/models/ui/` for UI presentation logic (InfoModal, ShortcutsModal, etc.)
- Removed monolithic `internal/models/cv.go` (300+ lines → organized packages)
2. **Testing** - Added comprehensive unit tests:
- `internal/models/cv/loader_test.go` - CV data loading and validation
- `internal/models/ui/loader_test.go` - UI translations loading
- All tests passing ✅
3. **Documentation** - Added Go learning knowledge base:
- `_go-learning/architecture/server-design.md` - Goroutines, graceful shutdown explained
- `_go-learning/refactorings/001-cv-model-separation.md` - This refactoring documented
- Public documentation showcasing Go expertise (README.md kept private)
4. **Handler Updates** - Updated imports to use new package structure:
- `internal/handlers/cv.go` - Uses `cvmodel` and `uimodel` aliases
**Benefits:**
- ✅ Clear separation of concerns (domain vs presentation)
- ✅ Better testability (isolated package testing)
- ✅ Improved maintainability (smaller, focused files)
- ✅ Scalability (each domain can evolve independently)
- ✅ Follows Go best practices (small, cohesive packages)
**Other Updates:**
- Updated middleware security checks
- Template improvements
- Organized completed prompts
**Testing:**
- All Go unit tests pass (cv, ui, handlers)
- Server verified with curl tests (English, Spanish, Health endpoints)
- Frontend functionality unchanged (refactoring is transparent to UI)
2025-11-20 16:17:56 +00:00