PROBLEM:
- api.rs was duplicating uniffi functionality for NAPI bindings
- Every new function had to be written twice (uniffi + api.rs)
- Classic DRY violation with identical sync wrappers
SOLUTION:
- Updated NAPI bindings to use uniffi functions directly
- Deleted redundant api.rs file entirely
- Fixed uniffi::events::submit_event_json signature to match NAPI needs
BENEFITS:
✅ Single source of truth - functions only exist in uniffi modules
✅ Zero duplication - NAPI and UniFFI use identical implementations
✅ Future-proof - new functions only need to be added once
✅ Maintains compatibility for both binding systems
This completes our DRY/KISS refactoring by eliminating the last
major code duplication in the project.
Major architectural improvements:
SMART API VERSION SELECTION:
- Auto-selects V2 for events (fixes timezone bugs), V1 for legacy endpoints
- EndpointVersion::best_for_path() based on backend route analysis
- Prevents EST-reported-as-UTC client issues automatically
DRY UTILITIES:
- QueryBuilder eliminates ~37 lines of duplicate code per module
- ApiResultExt trait for consistent NotFound → None handling
- PaginationParamsExt for unified query parameter building
ZERO-COST ABSTRACTIONS:
- Generic ApiEndpoint<T> reduces verbose implementations to single-line calls
- All abstractions compile away - no runtime overhead
- Type-safe APIs with compile-time bounds
MODEL CONSOLIDATION:
- Moved ApiVersion to common.rs (logical organization)
- Removed redundant models/v2.rs file
TECHNICAL DEBT CLEANUP:
- Removed broken test code with hardcoded stale model structures
- Eliminated non-deterministic timestamp-dependent tests
COMPATIBILITY:
- Maintains full compatibility for all three clients:
* Native Rust
* UniFFI bindings (Swift/Kotlin)
* NAPI-rs (Node.js/Astro)
VERIFICATION:
- All 26 tests passing
- Zero compilation errors
- Only cosmetic unused import warnings remain
This refactor demonstrates Rust's power for zero-cost abstractions while
achieving true modularity and eliminating hundreds of lines of duplicate code.
- Add shared date formatting function to eliminate DRY violations
- Fix livestream cards showing raw ISO dates by using shared formatter
- Update formatted_start_time() to return time range (start - end) for events
- Switch events API to use v2 endpoint to avoid timezone conversion issues
- Map duration_string to duration field for frontend compatibility
- Add api.rs with all web-specific API functions
- Add admin_login and validate_admin_token methods to ChurchApiClient
- Add image fields to EventSubmission model
- Add submit_event_with_image and submit_event_multipart functions
- Update test files for new EventSubmission fields
This consolidates the web church-core into the main crate to achieve single source of truth.
Move build scripts, test scripts, examples, and generated files to scripts/ directory.
Update .gitignore to exclude scripts/ from future commits to keep repository clean.
Add church management API library with cross-platform support for iOS, Android, and WASM.
Features include event management, bulletin handling, contact forms, and authentication.