-
Notifications
You must be signed in to change notification settings - Fork 106
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
[5기 손가현] Shorten-URL 과제 제출합니다. #72
base: hyun2371
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
과제 고생하셨습니다~!!
질문 주신 부분들은 해당 부분에 답글 달았습니다!
Url savedUrl = getSavedUrl(request.originUrl()); | ||
|
||
savedUrl.increaseRequestCount(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
질문주신 orElseGet
으로 처리해도 괜찮을 것 같습니다. 다만 개선하면 좋을 포인트가 있습니다.
- 트랜잭션 범위를 줄여도 괜찮을 것 같습니다.
- 위 경우대로 값을 불러오면 처음 생성한 url 도 요청수가 +1 되서 나오게 됩니다.
@InjectMocks | ||
private UrlService service; | ||
|
||
@DisplayName("Base62인코딩으로 shortenUrl을 생성할 수 있다.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
테스트 작성해주신 부분은 좋지만 추가되면 좋을 부분이 있습니다.
테스트만 봤을 때는 요구사항을 만족하는지 알 수가 없습니다.
- 8글자 이내로 생성되었는지?
- 요청 수가 저장되었는지?
📌 과제 설명
원본 url을 shortUrl로 변환해주는 애플리케이션입니다.
요구사항
각 요구사항을 모두 충족할 수 있도록 노력해봅시다.
구현 내용
구현 이미지
사용자가 url을 넣어주면 shortUrl로 변환합니다.
해당 shortUrl 클릭시 사용자가 붙여넣은 url로 이동됩니다.
✅ PR 포인트 & 궁금한 점
optional.orElseGet(()->repository.save(urlEntity))
을 사용하는게 더 나은 방법일지 궁금합니다.