-
Notifications
You must be signed in to change notification settings - Fork 1
feat: 약관동의여부 API 기능개발 #51
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
Changes from all commits
5e0944e
b1cd818
fe8ded3
a547b7e
10cd08f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| package org.yapp.apis.auth.dto.request | ||
|
|
||
| import io.swagger.v3.oas.annotations.media.Schema | ||
| import jakarta.validation.constraints.NotNull | ||
|
|
||
| @Schema(description = "Request to update terms agreement status") | ||
| data class TermsAgreementRequest private constructor( | ||
| @Schema(description = "Whether the user agrees to the terms of service", example = "true", required = true) | ||
| val termsAgreed: Boolean? = null | ||
|
|
||
|
Comment on lines
+8
to
+10
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. valid 로직이 빠진 것 같아요!!
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. valid validTermsAgreed() 여기있어요!!~ |
||
|
|
||
| ) { | ||
| fun validTermsAgreed(): Boolean = termsAgreed!! | ||
|
Comment on lines
+7
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. null 안전성 문제와 검증 로직을 개선해야 합니다. 현재 구현에는 심각한 문제가 있습니다:
다음과 같이 수정하는 것을 권장합니다: +import jakarta.validation.constraints.NotNull
@Schema(description = "Request to update terms agreement status")
-data class TermsAgreementRequest private constructor(
+data class TermsAgreementRequest(
- @Schema(description = "Whether the user agrees to the terms of service", example = "true", required = true)
- val termsAgreed: Boolean? = null
+ @field:NotNull(message = "약관 동의 여부는 필수입니다")
+ @Schema(description = "Whether the user agrees to the terms of service", example = "true", required = true)
+ val termsAgreed: Boolean?
-
-
-) {
- fun validTermsAgreed(): Boolean = termsAgreed!!
-}
+)그리고 컨트롤러에서는 🤖 Prompt for AI Agents |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,18 +18,18 @@ import java.util.UUID | |
| class UserBookService( | ||
| private val userBookDomainService: UserBookDomainService | ||
| ) { | ||
| fun upsertUserBook(upsertUserBookRequest: UpsertUserBookRequest): UserBookResponse = | ||
| UserBookResponse.from( | ||
| userBookDomainService.upsertUserBook( | ||
| upsertUserBookRequest.userId, | ||
| upsertUserBookRequest.bookIsbn, | ||
| upsertUserBookRequest.bookTitle, | ||
| upsertUserBookRequest.bookAuthor, | ||
| upsertUserBookRequest.bookPublisher, | ||
| upsertUserBookRequest.bookCoverImageUrl, | ||
| upsertUserBookRequest.status | ||
| ) | ||
| fun upsertUserBook(upsertUserBookRequest: UpsertUserBookRequest): UserBookResponse { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (사소) UpsertUserBookRequest의 필드에도 validation을 하면 좋을 것 같다는 생각이 듭니다!! |
||
| val userBookInfoVO = userBookDomainService.upsertUserBook( | ||
| upsertUserBookRequest.validUserId(), | ||
| upsertUserBookRequest.validBookIsbn(), | ||
| upsertUserBookRequest.validBookTitle(), | ||
| upsertUserBookRequest.validBookAuthor(), | ||
| upsertUserBookRequest.validBookPublisher(), | ||
| upsertUserBookRequest.validBookCoverImageUrl(), | ||
| upsertUserBookRequest.validStatus() | ||
| ) | ||
| return UserBookResponse.from(userBookInfoVO) | ||
| } | ||
|
|
||
| fun findAllUserBooks(userId: UUID): List<UserBookResponse> { | ||
| val userBooks: List<UserBookInfoVO> = userBookDomainService.findAllUserBooks(userId) | ||
|
|
@@ -39,12 +39,11 @@ class UserBookService( | |
| } | ||
|
|
||
| fun findAllByUserIdAndBookIsbnIn(userBooksByIsbnsRequest: UserBooksByIsbnsRequest): List<UserBookResponse> { | ||
| return userBookDomainService | ||
| .findAllByUserIdAndBookIsbnIn( | ||
| userBooksByIsbnsRequest.validUserId(), | ||
| userBooksByIsbnsRequest.validIsbns(), | ||
| ) | ||
| .map { UserBookResponse.from(it) } | ||
| val userBooks = userBookDomainService.findAllByUserIdAndBookIsbnIn( | ||
| userBooksByIsbnsRequest.validUserId(), | ||
| userBooksByIsbnsRequest.validIsbns(), | ||
| ) | ||
| return userBooks.map { UserBookResponse.from(it) } | ||
| } | ||
|
|
||
| private fun findUserBooksByDynamicCondition( | ||
|
|
@@ -53,8 +52,8 @@ class UserBookService( | |
| sort: String?, | ||
| pageable: Pageable | ||
| ): Page<UserBookResponse> { | ||
| return userBookDomainService.findUserBooksByDynamicCondition(userId, status, sort, pageable) | ||
| .map { UserBookResponse.from(it) } | ||
| val page = userBookDomainService.findUserBooksByDynamicCondition(userId, status, sort, pageable) | ||
| return page.map { UserBookResponse.from(it) } | ||
| } | ||
|
|
||
| fun findUserBooksByDynamicConditionWithStatusCounts( | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -28,6 +28,7 @@ data class User private constructor( | |||||||||
| val providerType: ProviderType, | ||||||||||
| val providerId: ProviderId, | ||||||||||
| val role: Role, | ||||||||||
| val termsAgreed: Boolean = false, | ||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) 도메인 모델에 약관 동의 필드가 적절히 추가되었습니다. 기본값 클래스 문서화 주석(19-22줄)에 새로 추가된 * @property role The roles of the user (e.g., USER, ADMIN).
+* @property termsAgreed Whether the user has agreed to the terms and conditions.
* @property createdAt The timestamp when the user was created.📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @minwoo1999 요거 주석 달면 좋을 거 같아요~ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||||||
| val createdAt: LocalDateTime? = null, | ||||||||||
| val updatedAt: LocalDateTime? = null, | ||||||||||
| val deletedAt: LocalDateTime? = null | ||||||||||
|
|
@@ -40,13 +41,20 @@ data class User private constructor( | |||||||||
| ) | ||||||||||
| } | ||||||||||
|
|
||||||||||
| fun updateTermsAgreement(termsAgreed: Boolean): User { | ||||||||||
| return this.copy( | ||||||||||
| termsAgreed = termsAgreed | ||||||||||
| ) | ||||||||||
| } | ||||||||||
|
|
||||||||||
| companion object { | ||||||||||
| fun create( | ||||||||||
| email: String, | ||||||||||
| nickname: String, | ||||||||||
| profileImageUrl: String?, | ||||||||||
| providerType: ProviderType, | ||||||||||
| providerId: String | ||||||||||
| providerId: String, | ||||||||||
| termsAgreed: Boolean = false | ||||||||||
| ): User { | ||||||||||
| return User( | ||||||||||
| id = Id.newInstance(UuidGenerator.create()), | ||||||||||
|
|
@@ -55,7 +63,8 @@ data class User private constructor( | |||||||||
| profileImageUrl = profileImageUrl, | ||||||||||
| providerType = providerType, | ||||||||||
| providerId = ProviderId.newInstance(providerId), | ||||||||||
| role = Role.USER | ||||||||||
| role = Role.USER, | ||||||||||
| termsAgreed = termsAgreed | ||||||||||
| ) | ||||||||||
| } | ||||||||||
|
|
||||||||||
|
|
@@ -66,7 +75,8 @@ data class User private constructor( | |||||||||
| profileImageUrl: String?, | ||||||||||
| providerType: ProviderType, | ||||||||||
| providerId: String, | ||||||||||
| role: Role | ||||||||||
| role: Role, | ||||||||||
| termsAgreed: Boolean = false | ||||||||||
| ): User { | ||||||||||
| return User( | ||||||||||
| id = Id.newInstance(UuidGenerator.create()), | ||||||||||
|
|
@@ -75,7 +85,8 @@ data class User private constructor( | |||||||||
| profileImageUrl = profileImageUrl, | ||||||||||
| providerType = providerType, | ||||||||||
| providerId = ProviderId.newInstance(providerId), | ||||||||||
| role = role | ||||||||||
| role = role, | ||||||||||
| termsAgreed = termsAgreed | ||||||||||
| ) | ||||||||||
| } | ||||||||||
|
|
||||||||||
|
|
@@ -87,6 +98,7 @@ data class User private constructor( | |||||||||
| providerType: ProviderType, | ||||||||||
| providerId: ProviderId, | ||||||||||
| role: Role, | ||||||||||
| termsAgreed: Boolean = false, | ||||||||||
| createdAt: LocalDateTime? = null, | ||||||||||
| updatedAt: LocalDateTime? = null, | ||||||||||
| deletedAt: LocalDateTime? = null | ||||||||||
|
|
@@ -99,6 +111,7 @@ data class User private constructor( | |||||||||
| providerType = providerType, | ||||||||||
| providerId = providerId, | ||||||||||
| role = role, | ||||||||||
| termsAgreed = termsAgreed, | ||||||||||
| createdAt = createdAt, | ||||||||||
| updatedAt = updatedAt, | ||||||||||
| deletedAt = deletedAt | ||||||||||
|
|
||||||||||
Uh oh!
There was an error while loading. Please reload this page.