From efa51b4fcc4f81741c781a79c3eaa5707062a123 Mon Sep 17 00:00:00 2001 From: Akira Date: Sat, 6 Sep 2025 00:45:51 +0900 Subject: [PATCH] Fix API for bulk_upload_checkin_photos --- rog/urls.py | 4 ++-- rog/views_apis/api_bulk_photo_upload.py | 18 ++++++++++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/rog/urls.py b/rog/urls.py index 113f9d0..a6727ae 100755 --- a/rog/urls.py +++ b/rog/urls.py @@ -206,8 +206,8 @@ urlpatterns += [ path('approve_checkin_history/', approve_checkin_history, name='approve_checkin_history'), ## Bulk Photo Upload & Checkin Correction - path('api/bulk_upload_checkin_photos/', bulk_upload_checkin_photos, name='bulk_upload_checkin_photos'), - path('api/get_bulk_upload_status/', get_bulk_upload_status, name='get_bulk_upload_status'), + path('bulk_upload_checkin_photos/', bulk_upload_checkin_photos, name='bulk_upload_checkin_photos'), + path('get_bulk_upload_status/', get_bulk_upload_status, name='get_bulk_upload_status'), ## Waypoint path('get_waypoint_datas_from_rogapp', get_waypoint_datas_from_rogapp, name='get_waypoint_datas_from_rogapp'), diff --git a/rog/views_apis/api_bulk_photo_upload.py b/rog/views_apis/api_bulk_photo_upload.py index 97771f4..eff0a24 100644 --- a/rog/views_apis/api_bulk_photo_upload.py +++ b/rog/views_apis/api_bulk_photo_upload.py @@ -24,7 +24,7 @@ from ..models import NewEvent2, Entry, GpsLog, Location2025 # ログ設定 logger = logging.getLogger(__name__) -@api_view(['POST']) +@api_view(['POST', 'GET']) @permission_classes([IsAuthenticated]) @parser_classes([MultiPartParser, FormParser]) def bulk_upload_checkin_photos(request): @@ -42,7 +42,21 @@ def bulk_upload_checkin_photos(request): request_id = str(uuid.uuid4())[:8] client_ip = request.META.get('HTTP_X_FORWARDED_FOR', request.META.get('REMOTE_ADDR', 'Unknown')) - logger.info(f"[BULK_UPLOAD] 🎯 API call started - ID: {request_id}, User: {request.user.email if request.user.is_authenticated else 'Anonymous'}, Client IP: {client_ip}") + logger.info(f"[BULK_UPLOAD] 🎯 API ACCESS CONFIRMED - bulk_upload_checkin_photos called successfully - ID: {request_id}, Method: {request.method}, User: {request.user.email if request.user.is_authenticated else 'Anonymous'}, Client IP: {client_ip}") + logger.info(f"[BULK_UPLOAD] 🔍 Request details - Content-Type: {request.content_type}, POST data keys: {list(request.POST.keys())}, FILES count: {len(request.FILES)}") + + # GETリクエストの場合は、APIが動作していることを確認するための情報を返す + if request.method == 'GET': + logger.info(f"[BULK_UPLOAD] 📋 GET request received - returning API status") + return Response({ + "status": "ACTIVE", + "message": "一括写真アップロードAPIが動作中です", + "endpoint": "/api/bulk_upload_checkin_photos/", + "method": "POST", + "required_params": ["event_code", "zekken_number", "photos"], + "optional_params": ["auto_process"], + "user": request.user.email if request.user.is_authenticated else 'Not authenticated' + }, status=status.HTTP_200_OK) try: # リクエストデータの取得