- Create response.py with success_response(), error_response(), paginated_response() - Add unit tests for all response utility functions - Create /api/ping/ health check endpoint using new format - Update __init__.py to export response functions - All changes are non-breaking - existing code unaffected This implements Section 1 Task 1 from API-IMPLEMENTATION-PLAN-SECTION1.md Ready for testing before applying to existing endpoints. Ref: unified-api/API-IMPLEMENTATION-PLAN-SECTION1.md
34 lines
825 B
Python
34 lines
825 B
Python
"""
|
|
API Views for IGNY8 Core
|
|
|
|
Health check and utility endpoints.
|
|
"""
|
|
|
|
from rest_framework.views import APIView
|
|
from django.utils import timezone
|
|
from igny8_core.api.response import success_response
|
|
|
|
|
|
class PingView(APIView):
|
|
"""
|
|
Health check endpoint for API availability.
|
|
|
|
Returns simple pong response to verify API is live.
|
|
This endpoint uses the new unified response format.
|
|
"""
|
|
permission_classes = [] # Public endpoint - no authentication required
|
|
|
|
def get(self, request):
|
|
"""
|
|
Return health check response in unified format.
|
|
"""
|
|
return success_response(
|
|
data={
|
|
"pong": True,
|
|
"time": timezone.now().isoformat(),
|
|
"version": "1.0.0"
|
|
},
|
|
message="API is live"
|
|
)
|
|
|