• Aryan Noshirvnai's avatar
    Replace GeoDrop with LiveLocation: live position + currently-playing song · 5bbe811c
    Aryan Noshirvnai authored
    GeoDrop was a one-off "drop a song at this exact point" pin, permanent
    once created. Redesigning it as a live broadcast instead: one row per
    user, continuously overwritten as their position and currently-playing
    song change, so nearby people see what you're listening to right now,
    not a static pin you left once.
    
    - LiveLocation model: unique per user_id, upserted on every meaningful
      location/song change plus a periodic heartbeat while sharing is on.
    - PUT /social/live-location - upsert (song_id nullable: sharing your
      position doesn't require actively playing something).
    - DELETE /social/live-location - stop sharing.
    - GET /social/live-location/nearby - other users' live positions within
      a radius, self-excluded, enriched with song/username, sorted by
      distance. Filters out anything not updated in the last 5 minutes
      (LIVE_LOCATION_STALE_AFTER) - there's no reliable way for a closing
      browser tab to notify the server with an authenticated request, so
      staleness expiry is the actual "they stopped sharing" mechanism, not
      a clean disconnect signal.
    - GET /social/live-location/{user_id}/stream - stream whatever a nearby
      user is currently playing, same cross-user reasoning as the other
      social stream endpoints.
    Co-Authored-By: 's avatarClaude Sonnet 5 <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
    5bbe811c
database.py 18.1 KB