• Stefy Lanza (nextime / spora )'s avatar
    Add /api/updates endpoint with fixture tracking and hybrid authentication (v1.2.0) · a27c1fa8
    Stefy Lanza (nextime / spora ) authored
    ## New Features
    - **New /api/updates endpoint**: Incremental fixture synchronization with optional timestamp filtering
      - Supports both GET (query params) and POST (JSON body) methods
      - Optional 'from' parameter for unix timestamp-based filtering
      - Returns fixtures updated after specified timestamp or last N fixtures
      - Includes ZIP download URLs in API response
      - Configurable default count via system settings
    
    - **Fixture active time tracking**: Automatic timestamp management
      - Added fixture_active_time column (BigInteger, indexed) to matches table
      - Automatic timestamp setting when all matches in fixture become active
      - Preserves original activation time (no overwrites)
    
    - **Hybrid authentication system**: Maximum compatibility
      - Supports JWT tokens (short-lived, from login) AND API tokens (long-lived, from web interface)
      - Tries JWT first, falls back to API tokens automatically
      - Multiple token header formats: Authorization Bearer, X-API-Token, query parameter
    
    - **SHA1-based ZIP file naming**: Consistent file naming
      - Uses SHA1 hash of (unix_timestamp + original_filename)
      - Applied across all upload methods for consistency
    
    ## Technical Implementation
    - **Database Migration_005**: Added fixture_active_time column with proper indexing
    - **System settings integration**: New api_updates_default_count setting (default: 10)
    - **Backfill utility**: backfill_fixture_times.py for existing fixture data migration
    - **Fallback mechanisms**: Graceful degradation for existing data without timestamps
    - **Query optimization**: Proper limits and ordering for both default and filtered queries
    
    ## Bug Fixes
    - Fixed logging import errors in models.py (get_logger function)
    - Python 2.7 compatibility fixes in migration scripts
    - Type conversion issues in SystemSettings.get_setting()
    
    ## Documentation
    - Created comprehensive CHANGELOG.md
    - Updated README.md with new endpoint documentation and examples
    - Added API usage examples for both GET and POST methods
    - Updated version to 1.2.0 with feature highlights
    
    ## Files Modified
    - app/api/routes.py: New /api/updates endpoint with hybrid auth
    - app/models.py: Added fixture tracking methods and backfill utility
    - app/database/migrations.py: Migration_005 for schema changes
    - backfill_fixture_times.py: Data migration utility for existing fixtures
    - README.md: Updated documentation and examples
    - CHANGELOG.md: Comprehensive change log following keep-a-changelog format
    a27c1fa8
Name
Last commit
Last update
..
api Loading commit data...
auth Loading commit data...
database Loading commit data...
main Loading commit data...
templates Loading commit data...
upload Loading commit data...
utils Loading commit data...
__init__.py Loading commit data...
models.py Loading commit data...