Commit graph

5 commits

Author SHA1 Message Date
Andros Fenollosa
551651afd9 Added etag and mod header 2025-11-05 15:03:20 +01:00
Andros Fenollosa
5f6666b372 Fixed format 2025-09-22 14:52:46 +02:00
Andros Fenollosa
12f38af3a2 Fix polls endpoints to match README specification
- Changed /polls/ to return simple URL array instead of full objects
- Changed /polls/votes/ to use 'post' parameter instead of 'feed' and 'poll_id'
- Updated /polls/votes/ response format to match README structure
- Updated all tests to match new API format
- Added proper URL parsing and validation for post parameter
- All 16 tests passing

API changes:
- GET /polls/ -> returns array of poll URLs
- GET /polls/votes/?post=<url> -> returns vote data grouped by option
2025-09-21 12:17:40 +02:00
Andros Fenollosa
c10e222c09 Show all polls (active and expired) in GET /polls/ endpoint
- Modified _get_all_polls() to return both active and expired polls
- Added is_active field to indicate poll status
- Updated test to reflect new behavior
- Polls are ordered by creation date (newest first)
2025-09-21 12:05:41 +02:00
Andros Fenollosa
bf6797ba55 Add polls endpoints functionality
Implemented comprehensive polls API endpoints for Org Social Relay:

- GET /polls/ - List all active polls in the system
- GET /polls/?feed=<url> - Get polls for a specific feed
- GET /polls/?voter=<url> - Get votes cast by a specific voter
- GET /polls/votes/?feed=<url>&poll_id=<id> - Get votes for a specific poll

Features:
- Complete API endpoints with proper error handling
- Comprehensive test suite with 15 test cases
- Caching for improved performance
- Response format compliance with existing API patterns
- Support for filtering active vs expired polls
- Vote counting and aggregation
- Query parameter validation

Technical details:
- Created new Django app 'polls' in app/polls/
- Added polls app to Django settings and URL configuration
- Uses existing poll models from feeds app (PollOption, PollVote)
- Follows established patterns for API responses and error handling
- All tests passing with proper Given/When/Then structure
2025-09-21 11:52:25 +02:00