Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
Expand All @@ -12,7 +10,7 @@ public class WebMvcConfig implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("http://localhost:3000", "http://54.66.149.225", " http://34.127.7.212")
.allowedOrigins("http://localhost:3000", "http://localhost:5173", "http://54.66.149.225", "http://34.127.7.212")
.allowedMethods("GET", "POST", "PUT", "DELETE")
.allowedHeaders("*") // 모든 헤더 허용
.allowCredentials(true); // 쿠키 포함 허용;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;


@FeignClient(name = "order-service", url = "http://34.127.7.212:8101")
@FeignClient(name = "order-service", url = "http://54.66.149.225:8100")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

서비스 URL 업데이트 확인됨

주문 서비스의 URL이 http://34.127.7.212:8101에서 http://54.66.149.225:8100으로 변경되었습니다. 이 변경사항이 모든 환경(개발, 테스트, 프로덕션)에서 일관되게 적용되었는지 확인하세요.

다음 스크립트를 실행하여 다른 서비스에서도 이 새 URL을 참조하고 있는지 확인하세요:


🏁 Script executed:

#!/bin/bash
# 프로젝트에서 이전 URL 참조 검색
rg -i "34.127.7.212:8101" --type java

Length of output: 37


다른 환경 설정 파일에도 이전 URL이 남아있을 수 있으므로, 코드뿐 아니라 설정 파일 전체를 대상으로 재검색해 주세요.


🏁 Script executed:

#!/bin/bash
# 전체 파일에서 이전 서비스 URL(34.127.7.212:8101) 참조 검색 (Java, YAML, Properties 등)
rg -F "34.127.7.212:8101" -n

Length of output: 181


이전 서비스 URL 참조 수정 필요

서비스 URL이 http://34.127.7.212:8101에서 http://54.66.149.225:8100으로 변경되었으나, 아래 파일에 아직 이전 URL이 남아 있습니다. 모든 참조를 새 URL로 업데이트해주세요.

  • payment-service/src/main/resources/static/index.html (라인 52)

수정 예시:

- <a href="http://34.127.7.212:8101/swagger-ui/index.html#/" class="link-button">스웨거로 이동하기</a>
+ <a href="http://54.66.149.225:8100/swagger-ui/index.html#/" class="link-button">스웨거로 이동하기</a>

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In
payment-service/src/main/java/gcu/web/paymentservice/platform/adapter/out/external/order/OrderFeignPort.java
at line 9, the FeignClient annotation URL has been updated to
"http://54.66.149.225:8100". Ensure that all other references to the old URL
"http://34.127.7.212:8101" in the entire project, including configuration files
and static resources like payment-service/src/main/resources/static/index.html
line 52, are also updated to the new URL to maintain consistency across all
environments.

public interface OrderFeignPort {

/*
Expand All @@ -15,8 +16,9 @@ public interface OrderFeignPort {
@PostMapping("/api/v1/orders/{orderId}/cancel")
String cancelOrder(@PathVariable("orderId") String orderId);

@PostMapping("/api/v1/orders/{orderId}")
String completeOrder(@PathVariable("orderId") String orderId);
@PutMapping("/api/v1/orders/{orderId}/submit")
String completeOrder(@PathVariable("orderId") Long orderId);


}

Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public Payment savePayment(ConfirmPaymentRequest confirmPaymentRequest) throws E
Payment saved = paymentPort.savePayment(payment);

// 주문 정보 전달
orderFeignPort.completeOrder(saved.getOrderId());
orderFeignPort.completeOrder(Long.valueOf(saved.getOrderId()));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

타입 변환 시 예외 처리 필요

String에서 Long으로 변환 시 orderId가 숫자 형식이 아닌 경우 NumberFormatException이 발생할 수 있습니다. 이 예외를 적절히 처리하는 것이 좋습니다.

다음과 같이 수정하는 것을 권장합니다:

- orderFeignPort.completeOrder(Long.valueOf(saved.getOrderId()));
+ try {
+     orderFeignPort.completeOrder(Long.valueOf(saved.getOrderId()));
+ } catch (NumberFormatException e) {
+     log.error("주문 ID 형식 오류: {}", saved.getOrderId(), e);
+     throw new IllegalStateException(ErrorCode.BAD_REQUEST.getMessage());
+ }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
orderFeignPort.completeOrder(Long.valueOf(saved.getOrderId()));
try {
orderFeignPort.completeOrder(Long.valueOf(saved.getOrderId()));
} catch (NumberFormatException e) {
log.error("주문 ID 형식 오류: {}", saved.getOrderId(), e);
throw new IllegalStateException(ErrorCode.BAD_REQUEST.getMessage());
}
🤖 Prompt for AI Agents
In
payment-service/src/main/java/gcu/web/paymentservice/platform/application/service/PaymentService.java
at line 66, the code converts orderId from String to Long without handling
potential NumberFormatException if the orderId is not a valid number. To fix
this, wrap the Long.valueOf conversion in a try-catch block to catch
NumberFormatException and handle it appropriately, such as logging the error and
preventing the method from proceeding with an invalid orderId.


return saved;

Expand Down