-
Notifications
You must be signed in to change notification settings - Fork 0
[✨feat] InternshipAnnouncementUrl VO 구현 #63
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
base: feat/#60
Are you sure you want to change the base?
Conversation
http 또는 https로 시작하는 유효한 URL만 허용하는 InternshipAnnouncementUrl 값을 구현했습니다. JPA 내장 타입으로 사용할 수 있도록 @embeddable을 적용하고, 유효성 검증 및 equals, hashCode, toString 메서드를 정의했습니다.
InternshipAnnouncementUrl VO에서 사용할 INVALID_ANNOUNCEMENT_URL 오류 코드를 추가했습니다. http/https로 시작하지 않는 URL 입력 시 예외를 발생시키는 데 사용됩니다.
http/https로 시작하는 경우 객체가 정상 생성되는지 검증하고, 그 외의 경우 예외가 발생하는지 테스트를 통해 확인했습니다.
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.
Pull Request Overview
This PR implements the value object InternshipAnnouncementUrl to enforce that only URLs beginning with http or https are accepted, thereby ensuring domain-level data integrity.
- Adds the InternshipAnnouncementUrl VO with built-in URL validation and immutability.
- Implements corresponding tests to verify valid and invalid URL behavior.
- Updates the InternshipErrorCode enum with an INVALID_ANNOUNCEMENT_URL entry to standardize error handling.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
src/test/kotlin/com/terning/server/kotlin/domain/internshipAnnouncement/InternshipAnnouncementUrlTest.kt | Tests validate proper creation and exception throwing for URL inputs. |
src/main/kotlin/com/terning/server/kotlin/domain/internshipAnnouncement/InternshipErrorCode.kt | Adds error code for announcement URLs supporting consistent exception handling. |
src/main/kotlin/com/terning/server/kotlin/domain/internshipAnnouncement/InternshipAnnouncementUrl.kt | Introduces the VO with embedded URL validation logic. |
fun from(value: String): InternshipAnnouncementUrl = InternshipAnnouncementUrl(value) | ||
|
||
private fun validateUrl(value: String) { | ||
if (!value.startsWith("http")) { |
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.
[nitpick] The URL validation check using startsWith("http") might be too permissive, as it could unintentionally allow strings like 'httpdummy'. Consider explicitly checking for 'http://' or 'https://' to ensure only valid URLs are accepted.
if (!value.startsWith("http")) { | |
if (!(value.startsWith("http://") || value.startsWith("https://"))) { |
Copilot uses AI. Check for mistakes.
📄 Work Description
InternshipAnnouncementUrl
을 구현했습니다.InternshipException
을 발생시킵니다.@Embeddable
을 적용했습니다.InternshipErrorCode
에INVALID_ANNOUNCEMENT_URL
항목을 추가했습니다.💭 Thoughts
✅ Testing Result
🗂 Related Issue