refactor(api): replace hardcoded URLs with dynamic URL generation
Replace hardcoded localhost URLs (http://127.0.0.1:8000) in API root endpoint documentation with request.build_absolute_uri() calls. This makes the API documentation URLs environment-agnostic and ensures they reflect the actual domain/host being used to access the API, improving portability across development, staging, and production environments.
This commit is contained in:
parent
c5f94d254e
commit
4acd78988e
@ -105,7 +105,7 @@ def api_root(request, format=None):
|
||||
"endpoints": {
|
||||
"admin_availability": {
|
||||
"description": "Get or update admin weekly availability (Admin only)",
|
||||
"url": "http://127.0.0.1:8000/api/meetings/admin/availability/",
|
||||
"url": request.build_absolute_uri("/api/meetings/admin/availability/"),
|
||||
"methods": ["GET", "PUT", "PATCH"],
|
||||
"authentication": "Required (Staff users only)",
|
||||
"response_fields": {
|
||||
@ -118,14 +118,14 @@ def api_root(request, format=None):
|
||||
},
|
||||
"available_dates": {
|
||||
"description": "Get available appointment dates for the next 30 days (Public)",
|
||||
"url": "http://127.0.0.1:8000/api/meetings/appointments/available-dates/",
|
||||
"url": request.build_absolute_uri("/api/meetings/appointments/available-dates/"),
|
||||
"methods": ["GET"],
|
||||
"authentication": "None required",
|
||||
"response": "List of available dates in YYYY-MM-DD format"
|
||||
},
|
||||
"create_appointment": {
|
||||
"description": "Create a new appointment request (Public)",
|
||||
"url": "http://127.0.0.1:8000/api/meetings/appointments/create/",
|
||||
"url": request.build_absolute_uri("/api/meetings/appointments/create/"),
|
||||
"methods": ["POST"],
|
||||
"authentication": "None required",
|
||||
"required_fields": [
|
||||
@ -146,7 +146,7 @@ def api_root(request, format=None):
|
||||
},
|
||||
"list_appointments": {
|
||||
"description": "List appointment requests (Admin sees all, users see their own)",
|
||||
"url": "http://127.0.0.1:8000/api/meetings/appointments/",
|
||||
"url": request.build_absolute_uri("/api/meetings/appointments/"),
|
||||
"methods": ["GET"],
|
||||
"authentication": "Required",
|
||||
"query_parameters": {
|
||||
@ -162,7 +162,7 @@ def api_root(request, format=None):
|
||||
},
|
||||
"appointment_detail": {
|
||||
"description": "Get detailed information about a specific appointment",
|
||||
"url": "http://127.0.0.1:8000/api/meetings/appointments/<uuid:pk>/",
|
||||
"url": request.build_absolute_uri("/api/meetings/appointments/<uuid:pk>/"),
|
||||
"methods": ["GET"],
|
||||
"authentication": "Required",
|
||||
"url_parameter": "pk (UUID of the appointment)",
|
||||
@ -170,14 +170,14 @@ def api_root(request, format=None):
|
||||
},
|
||||
"user_appointments": {
|
||||
"description": "Get appointments for the authenticated user",
|
||||
"url": "http://127.0.0.1:8000/api/meetings/user/appointments/",
|
||||
"url": request.build_absolute_uri("/api/meetings/user/appointments/"),
|
||||
"methods": ["GET"],
|
||||
"authentication": "Required",
|
||||
"response": "List of user's appointment requests with Jitsi meeting details"
|
||||
},
|
||||
"schedule_appointment": {
|
||||
"description": "Schedule an appointment and automatically create Jitsi meeting (Admin only)",
|
||||
"url": "http://127.0.0.1:8000/api/meetings/appointments/<uuid:pk>/schedule/",
|
||||
"url": request.build_absolute_uri("/api/meetings/appointments/<uuid:pk>/schedule/"),
|
||||
"methods": ["POST"],
|
||||
"authentication": "Required (Staff users only)",
|
||||
"required_fields": ["scheduled_datetime"],
|
||||
@ -202,7 +202,7 @@ def api_root(request, format=None):
|
||||
},
|
||||
"reject_appointment": {
|
||||
"description": "Reject an appointment request (Admin only)",
|
||||
"url": "http://127.0.0.1:8000/api/meetings/appointments/<uuid:pk>/reject/",
|
||||
"url": request.build_absolute_uri("/api/meetings/appointments/<uuid:pk>/reject/"),
|
||||
"methods": ["POST"],
|
||||
"authentication": "Required (Staff users only)",
|
||||
"optional_fields": ["rejection_reason"],
|
||||
@ -219,7 +219,7 @@ def api_root(request, format=None):
|
||||
},
|
||||
"jitsi_meeting_info": {
|
||||
"description": "Get Jitsi meeting information for a scheduled appointment",
|
||||
"url": "http://127.0.0.1:8000/api/meetings/appointments/<uuid:pk>/jitsi-meeting/",
|
||||
"url": request.build_absolute_uri("/api/meetings/appointments/<uuid:pk>/jitsi-meeting/"),
|
||||
"methods": ["GET"],
|
||||
"authentication": "Required",
|
||||
"prerequisites": "Appointment must be in 'scheduled' status",
|
||||
@ -235,7 +235,7 @@ def api_root(request, format=None):
|
||||
},
|
||||
"appointment_stats": {
|
||||
"description": "Get appointment statistics and analytics (Admin only)",
|
||||
"url": "http://127.0.0.1:8000/api/meetings/appointments/stats/",
|
||||
"url": request.build_absolute_uri("/api/meetings/appointments/stats/"),
|
||||
"methods": ["GET"],
|
||||
"authentication": "Required (Staff users only)",
|
||||
"response_fields": {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user