Files
igny8/backend/igny8_core/api/views.py
Desktop a722f6caa3 feat(api): add unified response format utilities (Section 1, Step 1.1-1.3)
- 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
2025-11-14 20:05:22 +05:00

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"
)