Commit Graph

2 Commits

Author SHA1 Message Date
bymyself
a6987bc379 Address CodeRabbit review comments
- Import ImageRef from maskEditorDataStore instead of duplicating
- Replace 'any' with proper UploadApiResponse type
- Add validation for dataURL strings
- Fix test mocking: use vi.spyOn for global.fetch
- Fix uploadMediaBatch test to use distinct response mocks
- Add test for invalid dataURL rejection
- Fix uploadMultipleFiles to return array of successful paths
- Optimize file size test to avoid timeout
2026-01-20 15:11:55 -08:00
bymyself
bbd337a1d3 Consolidate image upload implementations into shared service
Creates core uploadService to eliminate ~60-70 LOC duplication across multiple implementations.

Changes:
- Add src/platform/assets/services/uploadService.ts with uploadMedia() and uploadMediaBatch()
- Refactor Load3dUtils to use uploadService (eliminates 50+ LOC)
- Refactor WidgetSelectDropdown to use uploadService (eliminates 20+ LOC)
- Add comprehensive unit tests for uploadService
- Maintain backward compatibility for all existing APIs

Benefits:
- Single source of truth for upload logic
- Consistent error handling
- Type-safe interfaces
- Easier to test and maintain
2026-01-20 15:11:55 -08:00