Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[STEP2-1] 리다이렉트 기능 개발 및 코드베이스 리팩토링 #61

Open
wants to merge 7 commits into
base: Sung-Heon
Choose a base branch
from

Conversation

Sung-Heon
Copy link
Collaborator

주요 변경 내용

  1. URL 리다이렉트 기능 개발

    • /{code} 경로로 접근시 해당 코드에 매핑된 원본 URL로 리다이렉트하는 기능 추가
    • 존재하지 않는 코드에 대해서는 404 응답 처리
  2. ResponseEntity 적용

    • 모든 컨트롤러 메서드를 ResponseEntity를 반환하도록 수정하여 응답 일관성 확보
    • HTTP 상태 코드 및 헤더를 더 직관적으로 제어
  3. 관리자 기능 및 일반 사용자 기능 분리

    • AdminUrlShortenController 및 AdminUrlShortenService 추가
    • UrlMappingManager를 도입하여 데이터 관리 로직 중앙화
  4. 패키지 구조 정리

@Sung-Heon Sung-Heon requested a review from Hyune-c February 27, 2025 12:33
Copy link
Collaborator

@Hyune-c Hyune-c left a comment

Choose a reason for hiding this comment

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

리팩토링에서 의도하지 않은 성능 오류가 발생하면 신규 기능도 롤백 해야 되나요?

@PostMapping("/admin/shorten-urls")
public ResponseEntity<String> postShortenUrls(@RequestBody PostShortenUrlsRequest request) {
return ResponseEntity.ok(adminUrlShortenService.addToShortenUrls(request));
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

CreateShortenUrlRequest <-> PostShortenUrlsRequest

매우 비슷한 역할을 하는 request dto 인데 prefix 가 다릅니다.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

네. 비슷한 역할을 하지만 맥락이 다르다고 생각했습니다.

  1. create는 없던걸 새로이 만드는거고
    2)post는 기존에 있었던거를 migration으로 수동으로 밀어넣는거라고 생각했습니다.
    migration이라고 하기에는 먼가 이미 migration 끝단계에 해당하는 거라 post가 나을거라고 생각했습니다.

Copy link
Collaborator

Choose a reason for hiding this comment

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

전 post 가 POST 메서드를 뜻하는 것이라고 생각했는데, after 의 뜻이었군요.

  • postShortenUrls (afterShortenUrls)
  • 전 여전히 어색하다고 느끼지만 운영자의 의도가 있음으로 넘어가겠습니다.

실무에서도 이렇듯 모호한 네이밍이 사용되는 경우가 있습니다.

  • 이 경우 충분한 설명이나 주석을 권장 합니다.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

아 생각하신 post맞구요.
직관적이지 않은 네이밍같아서 수정했습니다.

private final AdminUrlShortenService adminUrlShortenService;

@GetMapping("/admin/shorten-urls")
public ResponseEntity<HashMapResponse> getAllShortenUrls() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

naming 에 자료구조를 명시한다면 dto 를 감쌀 이유가 있나요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

넵 수정했습니다.

@Sung-Heon
Copy link
Collaborator Author

리팩토링에서 의도하지 않은 성능 오류가 발생하면 신규 기능도 롤백 해야 되나요?

이정도 수준의 pr에서는 pr 단위안에서 수정하면 될것 같아서요.

좀더 대규모라면 리팩토링과 신규기능을 분리할필요는 있겠습니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants