• Aryan Noshirvnai's avatar
    Add song proposals + voting to Soundmarks, and a Nominatim geocode proxy · 8b2ac79a
    Aryan Noshirvnai authored
    Users can now propose a song for any soundmark; the most-voted
    proposal is what actually plays there, not just an admin's original
    pick. One vote per (soundmark, user), movable between proposals.
    Directly setting a soundmark's song (business/super admin) now also
    seeds a proposal with the setter's own vote, so it competes fairly
    in the same ranking instead of being a separate, un-votable channel
    that a single stray vote could trivially override - and instead of
    silently losing to the crowd the moment anyone else proposes
    something. Soundmark.song_id remains as the fallback used only while
    a soundmark has zero proposals.
    
    /soundmarks/nearby and /soundmarks/{id}/stream now resolve through
    the same popularity logic, so a soundmark that only has user
    proposals (no admin-set song_id at all) is discoverable and
    streamable too, not just admin-seeded ones.
    
    Also added GET /soundmarks/geocode, a server-side proxy to
    OpenStreetMap's free Nominatim geocoder for the webapp's upcoming
    location-picker autocomplete - proxied because Nominatim's usage
    policy requires a real, identifying User-Agent header, which browser
    JS can't set on a raw fetch().
    
    11 new tests (proposal creation/merging, vote-switching, popularity
    overriding the admin fallback, and the geocode proxy incl. failure
    handling) - 144 backend tests passing overall.
    Co-Authored-By: 's avatarClaude Sonnet 5 <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
    8b2ac79a
test_soundmarks.py 20.1 KB