feat(contentpreference): 본인인증 후 요청한 콘텐츠 선호값을 저장한다
This commit is contained in:
+18
-4
@@ -129,14 +129,28 @@ class MemberContentPreferenceService(
|
||||
}
|
||||
|
||||
@Transactional
|
||||
fun markAdultVisibleAfterAuthVerify(memberId: Long) {
|
||||
fun markAdultVisibleAfterAuthVerify(
|
||||
memberId: Long,
|
||||
isAdultContentVisible: Boolean = true,
|
||||
contentType: ContentType = ContentType.ALL
|
||||
) {
|
||||
val member = memberRepository.findByIdOrNull(memberId)
|
||||
?: throw SodaException(messageKey = "common.error.bad_credentials")
|
||||
|
||||
val preference = initializeDefaultPreference(member)
|
||||
if (!preference.isAdultContentVisible) {
|
||||
preference.isAdultContentVisible = true
|
||||
preference.adultContentVisibilityChangedAt = LocalDateTime.now()
|
||||
val now = LocalDateTime.now()
|
||||
var hasChanged = false
|
||||
if (preference.isAdultContentVisible != isAdultContentVisible) {
|
||||
preference.isAdultContentVisible = isAdultContentVisible
|
||||
preference.adultContentVisibilityChangedAt = now
|
||||
hasChanged = true
|
||||
}
|
||||
if (preference.contentType != contentType) {
|
||||
preference.contentType = contentType
|
||||
preference.contentTypeChangedAt = now
|
||||
hasChanged = true
|
||||
}
|
||||
if (hasChanged) {
|
||||
evictRecommendLiveCacheAfterCommit(memberId)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user