-
Notifications
You must be signed in to change notification settings - Fork 0
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
#62 - 유저는 차단된 유저 목록을 관리할 수 있다. #79
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.
자기야 간단하게 코멘트 남겼어요!
고생했어잉~🥰
import com.wespot.user.dto.response.UserResponse | ||
import java.time.LocalDateTime | ||
|
||
@JsonInclude(JsonInclude.Include.NON_NULL) |
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.
이거는 어떤 설정이죵?! Null이면 포함 안하는 건가요?
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.
네네 null인 데이터는 안내려줍니다!
setting = SettingResponse( | ||
isMessageNotification = false, // TODO : userConsent에 저장되어 있는 값으로 변경 | ||
isVoteNotification = false, // TODO : userConsent에 저장되어 있는 값으로 변경 | ||
isMarketingNotification = user.userConsent.consentValue ?: false |
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.
앗 마케팅으로 가는건가요 킹스트맨 명세 바꿔야겠네요오옹
receiverId: Long, | ||
cursorId: Long, | ||
blockedUserIds: List<Long>, | ||
blockedMessages: List<Long>, |
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.
ids라고 명시적으로 네이밍해주는 것도 좋을 것 같아요!!
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.
좋아요! 수정하겠습니다!
println("findAllByBlockerId") | ||
println(blockerId) |
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.
개발할 때 사용했던 출력은 지워주기~~~🥰
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.
헤헤 미안행 ㅠㅠ
check(!isAlreadyBlocked) { "이미 차단된 사용자입니다." } | ||
|
||
return when (isBlocked(loginUser.id, blockedUser.id)) { | ||
true -> unblockUser(loginUser.id, blockedUser.id) | ||
false -> blockUser(loginUser.id, blockedUser.id) | ||
} | ||
val createBlockedUser = BlockedUser.create( | ||
blockerId = loginUser.id, | ||
blockedId = blockedUser.id, | ||
messageId = messageId | ||
) | ||
val saveBlockedUser = blockedUserPort.save(createBlockedUser) |
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.
DDD 책에 한번 나온적이 있는데, 이런 것들은 Domain 영역으로 뺄 수 있을 것 같아요.
BlokcedUser.create하기 이전에 사용자가 차단당한적이 있었었는지 boolean 값을 넣어준다면, 이를 도메인 내부에서 처리할 수 있지 않을까요?!
data class BlockedUser(
val id: Long,
val blockerId: Long,
val blockedId: Long,
val messageId: Long,
val createdAt: LocalDateTime
) {
companion object {
fun create(
blockerId: Long,
blockedId: Long,
messageId: Long,
isAlreadyBlocked: Boolean,
): BlockedUser {
check(!isAlreadyBlocked) { "이미 차단된 사용자입니다." }
return BlockedUser(
id = 0,
blockerId = blockerId,
blockedId = blockedId,
messageId = messageId,
createdAt = LocalDateTime.now()
)
}
}
}
override fun blockedUser(messageId: Long): BlockedUserResponse {
val (loginUser, blockedUser) = findAndValidateUsers(messageId)
val isAlreadyBlocked = blockedUserPort.existsByBlockerIdAndBlockedIdAndMessageId(
blockerId = loginUser.id,
blockedId = blockedUser.id,
messageId = messageId
)
val createBlockedUser = BlockedUser.create(
blockerId = loginUser.id,
blockedId = blockedUser.id,
messageId = messageId,
isAlreadyBlocked = isAlreadyBlocked
)
// check(!isAlreadyBlocked) { "이미 차단된 사용자입니다." }
// val createBlockedUser = BlockedUser.create(
// blockerId = loginUser.id,
// blockedId = blockedUser.id,
// messageId = messageId,
// isAlreadyBlocked = isAlreadyBlocked
// )
val saveBlockedUser = blockedUserPort.save(createBlockedUser)
return BlockedUserResponse.of(saveBlockedUser.id)
}
이런 느낌으로요!
항상 말씀드리지만 선택적으로 반영해주세요~🥰
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.
좋습니다!!
순간적으로 db쪽이랑 연결되어서 넣으면 안된다고 생각했던 것 같아요 ㅜ.ㅜ
저거 반영해서 수정하면 좋을 것 같네요! 수정하겠습니다!
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.
네네 알러뷰~
884767f
to
169051c
Compare
1. 🔗 관련 이슈
2. 📄 구현한 내용 또는 수정한 내용
3. 🙌 추가적으로 알리고 싶은 내용
해당 부분도 참고하시면 좋을 것 같아요!!
4. 🙄 TODO / 고민하고 있는 것들
5. ✅ 배포 Checklist