Skip to content

Commit a481550

Browse files
committed
[#22] Refactor: 여행 계획 저장 API 권한 설정 변경
1 parent d662e3e commit a481550

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/main/java/com/example/triptalk/domain/tripPlan/controller/TripPlanController.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.example.triptalk.domain.tripPlan.controller;
22

3+
import com.example.triptalk.domain.tripPlan.dto.TripPlanRequest;
34
import com.example.triptalk.domain.tripPlan.dto.TripPlanResponse;
45
import com.example.triptalk.domain.tripPlan.enums.TripStatus;
56
import com.example.triptalk.domain.tripPlan.service.TripPlanService;
@@ -78,10 +79,18 @@ public ApiResponse<TripPlanResponse.TripPlanStatusDTO> markTripPlanAsTraveled(
7879
"""
7980
)
8081
public ApiResponse<TripPlanResponse.TripPlanDTO> createTripPlanFromFastAPI(
81-
@RequestBody com.example.triptalk.domain.tripPlan.dto.TripPlanRequest.CreateFromFastAPIDTO request,
82+
@RequestBody TripPlanRequest.CreateFromFastAPIDTO request,
8283
HttpServletRequest httpRequest
8384
) {
84-
Long userId = authUtil.getUserIdFromRequest(httpRequest);
85+
86+
// 인증이 없어도 동작하도록 변경
87+
Long userId = null;
88+
try {
89+
userId = authUtil.getUserIdFromRequest(httpRequest);
90+
} catch (Exception e) {
91+
// 인증 없음 → 익명 사용자로 처리하거나 무시
92+
}
93+
8594
TripPlanResponse.TripPlanDTO response = tripPlanService.createTripPlanFromFastAPI(userId, request);
8695
return ApiResponse.onSuccess(response);
8796
}

0 commit comments

Comments
 (0)