- Remove TranscodedMedia, TranscodingStatus, and TranscodingRequest models
- Delete 184-line commented stream_media function
- Clean up phantom service imports and dead references
- Remove unused test imports for non-existent services
Total cleanup: 265 lines of dead code removed from legacy Jellyfin compatibility layer.
Smart streaming pipeline remains unchanged and functional.
- Fix timezone detection logic to only consider dashes after 'T' as timezone indicators
- Reorder multipart datetime parsing to try flexible formats before strict RFC3339
- Resolves 400 "Invalid RFC3339 datetime" error for format like "2025-10-07T00:13"
- Event submissions now work correctly with local church time format
Replace inefficient loop with N database queries (1 + N schedules) with
optimized single query approach. Reduces database load and improves
response times for /api/schedule endpoint when fetching all schedules.
- Add ScheduleService::list_all_schedule_data_v1() method for single query
- Update handler to use optimized method instead of per-schedule queries
- Maintains identical API response format
- Scales better as schedule data grows
- New quarterly_orders table with validation and constraints
- Full CRUD API endpoints for quarterly orders management
- Import functionality for bulk quarterly data from JSON
- Python scripts for data migration and database import
- Consistent validation for quarterly types and amounts
- Follows established DRY/KISS architectural patterns
- SQL Layer Separation: Remove all SQL queries from service layers, achieving perfect Handler→Service→SQL architecture
- Response Standardization: Replace manual ApiResponse construction with helper functions (success_response, success_with_message, success_message_only)
- Sanitization Centralization: Create SanitizeDescription trait to eliminate HTML sanitization duplication across services
- Code Reduction: Delete 1,340 lines of duplicated code while adding 405 lines of clean infrastructure
- Zero Breaking Changes: All API contracts preserved, only internal architecture improved
- Enhanced Security: Automatic response sanitization via SanitizeOutput trait
Created SQL modules:
- src/sql/config.rs: Church configuration operations
- src/sql/media.rs: Media scanning and metadata operations
Refactored services:
- EventsV1Service: Use sql::events module, centralized sanitization
- PendingEventsService: Use sql::events module, centralized sanitization
- ConfigService: Use sql::config module
- MediaScannerService: Use sql::media module
- HymnalService: Simplified complex search query from 200+ to 20 lines
Standardized handlers:
- All handlers now use response helper functions
- Consistent error handling patterns
- Preserved exact JSON response format for frontend compatibility
Result: Perfect DRY/KISS compliance with zero API surface changes
RESTRUCTURING ACCOMPLISHED:
• Split monolithic EventService into focused services (EventsV1Service, EventsV2Service, PendingEventsService)
• Migrated ALL remaining direct SQL to shared sql::events functions
• Updated all handlers to use appropriate focused services
• Removed obsolete EventService completely
CONSISTENCY FIXES:
• ScheduleService: migrated to sql::schedule pattern (eliminated all direct SQL)
• HymnalService: fixed DRY/KISS violations using sql::hymnal for CRUD operations
• AuthService: ensured consistent sql::users usage
RESULT: All major services now follow Handler→Service→sql:: pattern consistently.
No more direct SQL violations. No more debugging nightmare inconsistencies.
Zero downtime maintained - HTTP responses unchanged.
- Eliminate manual ApiResponse construction in 5 handlers
- Add MemberService + sql::members following established pattern
- Create success_message_only() utility for empty responses
- Fix members handler: db::members direct calls → service layer
- Add SanitizeOutput for LoginResponse trait consistency
- All examined handlers now follow Handler → Service → SQL pattern
- Create sql:: module with raw SQL queries (no business logic)
- Services now call sql:: functions + handle conversion logic only
- Eliminate SQL duplication across V1/V2 service methods
- Remove redundant db:: wrapper functions for bulletins, bible_verses, schedule
- Clean Handler → Service → Shared SQL → DB architecture
- Maintain API compatibility, zero downtime
BREAKING: Removed CreateEventRequest - unused for direct creation
ADDED: UpdateEventRequest - clean editing with image support
IMPROVED: EventService now contains business logic, not wrapper calls
Architecture Changes:
- Before: Handler → Service → db::events → SQL (wasteful)
- After: Handler → Service → Direct SQL + Business Logic (clean)
Key Improvements:
✅ All EventService methods use direct SQL with real business logic
✅ Eliminated pointless db::events wrapper functions
✅ Added missing V2 service methods for consistency
✅ Fixed handler pattern violations (no more direct db calls)
✅ Preserved email notifications and HTTP response formats
✅ Applied sanitization, validation, error handling in services
Changes:
- Remove CreateEventRequest/V2 (unused create paths)
- Add UpdateEventRequest with image field (no redundant thumbnail)
- Migrate all EventService methods to direct SQL + business logic
- Fix v2/events.rs to use proper service methods consistently
- Remove create/update routes and handlers (unused)
- Maintain backward compatibility for all APIs
Next: Apply same DRY/KISS cleanup to BulletinService and others
- Complete rewrite of db/bulletins.rs using direct SQL queries only
- Remove all dependencies on dead *Operations patterns
- Enhanced error handling with specific error types (bulletin_not_found, duplicate_entry)
- Fix BulletinService to call db::bulletins:: directly instead of dead BulletinOperations
- Clean SQL with proper logging and error context
- Part of nuclear consolidation to Handler → Service → DB pattern
- Remove entire utils/db_operations.rs file and all *Operations patterns
- Comment out imports to dead operations
- This breaks compilation temporarily but eliminates the maintenance nightmare
- Next: rewrite db:: modules to use direct SQL instead of operations
- Goal: Clean Handler → Service → Database pattern only
- Remove all direct db:: calls from events.rs handler
- Add missing get_pending_by_id method to EventService
- Use specific error types (ApiError::event_not_found)
- Clean handler → service → database pattern
- First step in eliminating maintenance nightmare of multiple DB patterns
- Add comprehensive validation methods for dates, UUIDs, ranges, files
- Domain-specific validation functions for bulletins, events, hymnal search
- Enhanced recurring pattern validation with specific error types
- Better date range validation with improved error messages
- Foundation for consistent input validation across all endpoints
- All using new specific error types for better debugging
- Add specific error variants for better internal handling
- Enhance error messages with context and logging
- Improve database operations with better error handling
- Use specific errors for media processing, config issues, duplicates
- All HTTP responses remain identical - zero breaking changes
- Foundation for better maintainability and debugging
- Fixed 502 error when uploading thumbnails via admin panel
- Added /api/upload/events/:id/thumbnail route and handler
- Thumbnails saved with thumb_ prefix for organization
- Includes proper file cleanup when replacing existing thumbnails
- Resolves CORS issues by ensuring endpoint exists for proper middleware handling
- Created comprehensive README.md with setup instructions and API overview
- Removed 10 internal development .md files
- Updated .gitignore to prevent future development docs from being tracked
- Repository now has clean, professional documentation structure
- Removed all .fish and .sh utility scripts
- Removed test SQL files and debug scripts
- Removed temp files and symlinks
- Removed HTML test files and Python migration helpers
- Updated .gitignore to prevent these files from being tracked again
Repository now contains only essential project code and migrations.
Complete church management system with bulletin management, media processing, live streaming integration, and web interface. Includes authentication, email notifications, database migrations, and comprehensive test suite.