From 0c35548f1dd5dce78dd82592a139e2c4302c482a Mon Sep 17 00:00:00 2001 From: injoon2019 Date: Wed, 6 Nov 2024 23:02:40 +0900 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=ED=9A=8C=EC=9B=90=EA=B0=80?= =?UTF-8?q?=EC=9E=85=EC=8B=9C=203=EA=B0=9C=20=EB=B0=9B=EB=8F=84=EB=A1=9D?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bottles/api/bottle/facade/BottleFacade.kt | 2 +- .../api/bottle/facade/BottleFacadeV2.kt | 4 +- .../repository/BottleMatchingRepository.kt | 30 +++++++ .../app/bottle/service/BottleService.kt | 87 +++++++++++-------- .../UserProfileApplicationEventListener.kt | 3 +- .../app/user/repository/UserRepository.kt | 2 + .../app/user/service/UserProfileService.kt | 8 +- 7 files changed, 90 insertions(+), 46 deletions(-) diff --git a/api/src/main/kotlin/com/nexters/bottles/api/bottle/facade/BottleFacade.kt b/api/src/main/kotlin/com/nexters/bottles/api/bottle/facade/BottleFacade.kt index 64fa5bc9..99cbeb1d 100644 --- a/api/src/main/kotlin/com/nexters/bottles/api/bottle/facade/BottleFacade.kt +++ b/api/src/main/kotlin/com/nexters/bottles/api/bottle/facade/BottleFacade.kt @@ -74,7 +74,7 @@ class BottleFacade( if (isActiveMatching) { val matchingHour = BOTTLE_PUSH_TIME.hour bottleService.matchRandomBottle(user.id, matchingHour, blockUserIds, blockedMeUserIds) - ?.also { + .forEach { applicationEventPublisher.publishEvent( BottleMatchEventDto( bottleId = it.id, diff --git a/api/src/main/kotlin/com/nexters/bottles/api/bottle/facade/BottleFacadeV2.kt b/api/src/main/kotlin/com/nexters/bottles/api/bottle/facade/BottleFacadeV2.kt index 0a9e64c3..9bc5bd5d 100644 --- a/api/src/main/kotlin/com/nexters/bottles/api/bottle/facade/BottleFacadeV2.kt +++ b/api/src/main/kotlin/com/nexters/bottles/api/bottle/facade/BottleFacadeV2.kt @@ -49,7 +49,7 @@ class BottleFacadeV2( ).map { it.userId }.toSet() // 나를 차단한 유저 bottleService.matchRandomBottle(user.id, BOTTLE_PUSH_TIME.hour, blockUserIds, blockedMeUserIds) - ?.also { + .forEach { applicationEventPublisher.publishEvent( BottleMatchEventDto( bottleId = it.id, @@ -78,7 +78,7 @@ class BottleFacadeV2( ).map { it.userId }.toSet() // 나를 차단한 유저 bottleService.matchAdditionalRandomBottle(user.id, BOTTLE_PUSH_TIME.hour, blockUserIds, blockedMeUserIds) - ?.also { + .forEach { applicationEventPublisher.publishEvent( BottleMatchEventDto( bottleId = it.id, diff --git a/app/src/main/kotlin/com/nexters/bottles/app/bottle/repository/BottleMatchingRepository.kt b/app/src/main/kotlin/com/nexters/bottles/app/bottle/repository/BottleMatchingRepository.kt index c640ccf9..45a088df 100644 --- a/app/src/main/kotlin/com/nexters/bottles/app/bottle/repository/BottleMatchingRepository.kt +++ b/app/src/main/kotlin/com/nexters/bottles/app/bottle/repository/BottleMatchingRepository.kt @@ -71,6 +71,36 @@ class BottleMatchingRepository( ) } + fun findAllUserCanBeMatchedWithoutIntroduction(userId: Long, gender: Gender): List { + val sql = """ + SELECT u.id AS willMatchUserId, u.gender AS willMatchUserGender, u.city AS city + FROM user u + LEFT JOIN bottle_history bh ON bh.user_id = :userId AND bh.matched_user_id = u.id + WHERE bh.id IS NULL + AND u.id != :userId + AND u.gender != :gender + AND u.deleted = false + AND u.is_match_activated = true; + """.trimIndent() + + val namedParameters = mapOf( + "userId" to userId, + "gender" to gender.name + ) + + return namedParameterJdbcTemplate.query( + sql, + namedParameters, + { rs, _ -> + UsersCanBeMatchedDto( + willMatchUserId = rs.getLong("willMatchUserId"), + willMatchUserGender = rs.getString("willMatchUserGender"), + willMatchCity = rs.getString("city") + ) + } + ) + } + fun findAdditionalAllUserCanBeMatched(userId: Long, gender: Gender): List { val sql = """ SELECT u.id AS willMatchUserId, u.gender AS willMatchUserGender, u.city AS city diff --git a/app/src/main/kotlin/com/nexters/bottles/app/bottle/service/BottleService.kt b/app/src/main/kotlin/com/nexters/bottles/app/bottle/service/BottleService.kt index e4e0c22c..b54eea6b 100644 --- a/app/src/main/kotlin/com/nexters/bottles/app/bottle/service/BottleService.kt +++ b/app/src/main/kotlin/com/nexters/bottles/app/bottle/service/BottleService.kt @@ -167,32 +167,33 @@ class BottleService( userId: Long, matchingHour: Int, blockUserIds: Set, - blockedMeUserIds: Set - ): Bottle? { + blockedMeUserIds: Set, + count: Int = 1, + ): List { val user = userRepository.findByIdOrNull(userId) ?: throw IllegalStateException("회원가입 상태를 문의해주세요") - if (user.isNotRegisterProfile()) return null - if (user.isMatchInactive()) return null + if (user.isNotRegisterProfile()) return emptyList() + if (user.isMatchInactive()) return emptyList() val matchingTime = getMatchingTime(matchingHour) - if (user.lastRandomMatchedAt > matchingTime) return null + if (user.lastRandomMatchedAt > matchingTime) return emptyList() val usersCanBeMatched = bottleMatchingRepository.findAllUserCanBeMatched(user.id, user.gender!!) .filter { it.willMatchUserId !in blockUserIds } .filter { it.willMatchUserId !in blockedMeUserIds } - if (usersCanBeMatched.isEmpty()) return null + if (usersCanBeMatched.isEmpty()) return emptyList() - val matchingUserDto = findUserSameRegionOrRandom(usersCanBeMatched, user) - val matchingUser = userRepository.findByIdAndDeletedFalse(matchingUserDto.willMatchUserId) - ?: throw IllegalArgumentException("탈퇴한 회원입니다") + val matchingUserDtos = findUserSameRegionOrRandom(usersCanBeMatched, user, count) + val matchingUsers = userRepository.findByIdInAndDeletedFalse(matchingUserDtos.map { it.willMatchUserId }) - val bottle = Bottle(targetUser = user, sourceUser = matchingUser, expiredAt = matchingTime.plusDays(1)) - val savedBottle = bottleRepository.save(bottle) + val now = LocalDateTime.now() + var bottles = matchingUsers.map { matchingUser -> Bottle(targetUser = user, sourceUser = matchingUser, expiredAt = now.plusDays(1)) } + val savedBottles = bottleRepository.saveAll(bottles) user.updateLastRandomMatchedAt(LocalDateTime.now()) - return savedBottle + return savedBottles } @Transactional @@ -200,12 +201,13 @@ class BottleService( userId: Long, matchingHour: Int, blockUserIds: Set, - blockedMeUserIds: Set - ): Bottle? { + blockedMeUserIds: Set, + count: Int = 1, + ): List { val user = userRepository.findByIdOrNull(userId) ?: throw IllegalStateException("회원가입 상태를 문의해주세요") - if (user.isNotRegisterProfile()) return null - if (user.isMatchInactive()) return null + if (user.isNotRegisterProfile()) return emptyList() + if (user.isMatchInactive()) return emptyList() var usersCanBeMatched = bottleMatchingRepository.findAllUserCanBeMatched(user.id, user.gender!!) .filter { it.willMatchUserId !in blockUserIds } @@ -218,18 +220,18 @@ class BottleService( .filter { it.willMatchUserId !in blockedMeUserIds } } - if (usersCanBeMatched.isEmpty()) return null + if (usersCanBeMatched.isEmpty()) return emptyList() - val matchingUserDto = findUserSameRegionOrRandom(usersCanBeMatched, user) - val matchingUser = userRepository.findByIdAndDeletedFalse(matchingUserDto.willMatchUserId) - ?: throw IllegalArgumentException("탈퇴한 회원입니다") + val matchingUserDtos = findUserSameRegionOrRandom(usersCanBeMatched, user, count) + val matchingUsers = userRepository.findByIdInAndDeletedFalse(matchingUserDtos.map { it.willMatchUserId }) - val bottle = Bottle(targetUser = user, sourceUser = matchingUser, expiredAt = LocalDateTime.now().plusDays(1)) - val savedBottle = bottleRepository.save(bottle) + val now = LocalDateTime.now() + var bottles = matchingUsers.map { matchingUser -> Bottle(targetUser = user, sourceUser = matchingUser, expiredAt = now.plusDays(1)) } + val savedBottles = bottleRepository.saveAll(bottles) user.updateLastRandomMatchedAt(LocalDateTime.now()) - return savedBottle + return savedBottles } private fun getMatchingTime(matchingHour: Int): LocalDateTime { @@ -243,13 +245,25 @@ class BottleService( private fun findUserSameRegionOrRandom( usersCanBeMatchedDtos: List, - targetUser: User - ): UsersCanBeMatchedDto { - return usersCanBeMatchedDtos.shuffled() - .firstOrNull { + targetUser: User, + count: Int, + ): List { + val canBeMatchedDtos = usersCanBeMatchedDtos.shuffled() + .filter { targetUser.gender?.name != it.willMatchUserGender targetUser.city == it.willMatchCity - } ?: usersCanBeMatchedDtos[0] + } + + + // 필터링된 사용자가 count에 도달하지 못하면 추가로 사용자 채우기 + return if (canBeMatchedDtos.size < count) { + val additionalDtos = usersCanBeMatchedDtos.shuffled() + .filter { it !in canBeMatchedDtos } // 이미 선택된 항목을 제외 + .take(count - canBeMatchedDtos.size) // 모자란 개수만큼 추가 + canBeMatchedDtos + additionalDtos // 기존 결과에 추가 결과를 합쳐서 반환 + } else { + canBeMatchedDtos + } } @Transactional(readOnly = true) @@ -285,23 +299,22 @@ class BottleService( } @Transactional - fun matchFirstRandomBottle(userId: Long): Bottle? { + fun matchFirstRandomBottle(userId: Long, count: Int): List { val user = userRepository.findByIdOrNull(userId) ?: throw IllegalStateException("회원가입 상태를 문의해주세요") - val usersCanBeMatched = bottleMatchingRepository.findAllUserCanBeMatched(user.id, user.gender!!) - if (usersCanBeMatched.isEmpty()) return null + val usersCanBeMatched = bottleMatchingRepository.findAllUserCanBeMatchedWithoutIntroduction(user.id, user.gender!!).take(count) + if (usersCanBeMatched.isEmpty()) return emptyList() - val matchingUserDto = findUserSameRegionOrRandom(usersCanBeMatched, user) - val matchingUser = userRepository.findByIdAndDeletedFalse(matchingUserDto.willMatchUserId) - ?: throw IllegalArgumentException("탈퇴한 회원입니다") + val matchingUserDtos = findUserSameRegionOrRandom(usersCanBeMatched, user, count) + val matchingUsers = userRepository.findByIdInAndDeletedFalse(matchingUserDtos.map { it.willMatchUserId }) val now = LocalDateTime.now() - val bottle = Bottle(targetUser = user, sourceUser = matchingUser, expiredAt = now.plusDays(1)) - val savedBottle = bottleRepository.save(bottle) + var bottles = matchingUsers.map { matchingUser -> Bottle(targetUser = user, sourceUser = matchingUser, expiredAt = now.plusDays(1)) } + val savedBottles = bottleRepository.saveAll(bottles) user.updateLastRandomMatchedAt(now) - return savedBottle + return savedBottles } // TODO 클라이언트에서 문답 읽음 표시를 v2로 옮긴 후 변경 -> Letter의 isReadByOtherUser 제거 (이후 읽음 표시는 BottleReadHistory 한곳에서만 관리하도록 함) diff --git a/app/src/main/kotlin/com/nexters/bottles/app/user/component/event/UserProfileApplicationEventListener.kt b/app/src/main/kotlin/com/nexters/bottles/app/user/component/event/UserProfileApplicationEventListener.kt index dcbd939e..2220d709 100644 --- a/app/src/main/kotlin/com/nexters/bottles/app/user/component/event/UserProfileApplicationEventListener.kt +++ b/app/src/main/kotlin/com/nexters/bottles/app/user/component/event/UserProfileApplicationEventListener.kt @@ -21,7 +21,8 @@ class UserProfileApplicationEventListener( @Async @TransactionalEventListener fun handleCustomEvent(event: IntroductionSaveEventDto) { - bottleService.matchFirstRandomBottle(event.userId)?.let { + var savedBottles = bottleService.matchFirstRandomBottle(event.userId, 3) + savedBottles.forEach { bottleHistoryService.saveMatchingHistory(sourceUserId = it.sourceUser.id, targetUserId = it.targetUser.id) } } diff --git a/app/src/main/kotlin/com/nexters/bottles/app/user/repository/UserRepository.kt b/app/src/main/kotlin/com/nexters/bottles/app/user/repository/UserRepository.kt index 167a27e8..4ae90e6c 100644 --- a/app/src/main/kotlin/com/nexters/bottles/app/user/repository/UserRepository.kt +++ b/app/src/main/kotlin/com/nexters/bottles/app/user/repository/UserRepository.kt @@ -9,6 +9,8 @@ interface UserRepository : JpaRepository { fun findByIdAndDeletedFalse(id: Long): User? + fun findByIdInAndDeletedFalse(id: List): List + fun findAllByDeletedFalseAndIsMatchActivatedTrue(): List fun findByPhoneNumber(phoneNumber: String?): User? diff --git a/app/src/main/kotlin/com/nexters/bottles/app/user/service/UserProfileService.kt b/app/src/main/kotlin/com/nexters/bottles/app/user/service/UserProfileService.kt index 4aa1bc7b..91154e73 100644 --- a/app/src/main/kotlin/com/nexters/bottles/app/user/service/UserProfileService.kt +++ b/app/src/main/kotlin/com/nexters/bottles/app/user/service/UserProfileService.kt @@ -46,11 +46,9 @@ class UserProfileService( val isFirstRegisterIntroduction = it.introduction.isEmpty() it.introduction = introduction if (isFirstRegisterIntroduction) { - repeat(firstMatchingCount) { - applicationEventPublisher.publishEvent( - IntroductionSaveEventDto(userId = userId) - ) - } + applicationEventPublisher.publishEvent( + IntroductionSaveEventDto(userId = userId) + ) } } ?: run { profileRepository.save( From 703f63773376c22f1573088b7fb9ca8ed421ae96 Mon Sep 17 00:00:00 2001 From: injoon2019 Date: Wed, 6 Nov 2024 23:13:31 +0900 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20=EC=9E=90=EA=B8=B0=EC=86=8C?= =?UTF-8?q?=EA=B0=9C=20=EC=9E=91=EC=84=B1=EC=8B=9C=20=EC=A3=BC=EB=8A=94=20?= =?UTF-8?q?=EB=B3=B4=ED=8B=80=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/auth/component/AuthApplicationEventListener.kt | 2 +- .../com/nexters/bottles/api/auth/facade/AuthFacade.kt | 4 ++-- .../bottles/app}/auth/event/AuthApiEventListener.kt | 3 +-- .../nexters/bottles/app/auth}/event/DeleteUserEventDto.kt | 2 +- .../com/nexters/bottles/app/auth/event}/SignUpEventDto.kt | 2 +- .../component/event/UserProfileApplicationEventListener.kt | 4 ++-- .../user/component/event/dto/IntroductionSaveEventDto.kt | 6 ------ .../nexters/bottles/app/user/service/UserProfileService.kt | 7 ------- 8 files changed, 8 insertions(+), 22 deletions(-) rename {api/src/main/kotlin/com/nexters/bottles/api => app/src/main/kotlin/com/nexters/bottles/app}/auth/event/AuthApiEventListener.kt (93%) rename {api/src/main/kotlin/com/nexters/bottles/api/auth/component => app/src/main/kotlin/com/nexters/bottles/app/auth}/event/DeleteUserEventDto.kt (61%) rename {api/src/main/kotlin/com/nexters/bottles/api/auth/event/dto => app/src/main/kotlin/com/nexters/bottles/app/auth/event}/SignUpEventDto.kt (64%) delete mode 100644 app/src/main/kotlin/com/nexters/bottles/app/user/component/event/dto/IntroductionSaveEventDto.kt diff --git a/api/src/main/kotlin/com/nexters/bottles/api/auth/component/AuthApplicationEventListener.kt b/api/src/main/kotlin/com/nexters/bottles/api/auth/component/AuthApplicationEventListener.kt index 3cee3405..8d9c4a98 100644 --- a/api/src/main/kotlin/com/nexters/bottles/api/auth/component/AuthApplicationEventListener.kt +++ b/api/src/main/kotlin/com/nexters/bottles/api/auth/component/AuthApplicationEventListener.kt @@ -1,6 +1,6 @@ package com.nexters.bottles.api.auth.component -import com.nexters.bottles.api.auth.component.event.DeleteUserEventDto +import com.nexters.bottles.app.auth.event.DeleteUserEventDto import com.nexters.bottles.app.auth.service.BlackListService import com.nexters.bottles.app.auth.service.RefreshTokenService import com.nexters.bottles.app.bottle.service.BottleCachingService diff --git a/api/src/main/kotlin/com/nexters/bottles/api/auth/facade/AuthFacade.kt b/api/src/main/kotlin/com/nexters/bottles/api/auth/facade/AuthFacade.kt index daa8e124..7598fdf5 100644 --- a/api/src/main/kotlin/com/nexters/bottles/api/auth/facade/AuthFacade.kt +++ b/api/src/main/kotlin/com/nexters/bottles/api/auth/facade/AuthFacade.kt @@ -5,8 +5,8 @@ import com.nexters.bottles.api.auth.component.ApplePublicKeyGenerator import com.nexters.bottles.api.auth.component.AuthCodeGenerator import com.nexters.bottles.api.auth.component.JwtTokenProvider import com.nexters.bottles.api.auth.component.NaverSmsEncoder -import com.nexters.bottles.api.auth.component.event.DeleteUserEventDto -import com.nexters.bottles.api.auth.event.dto.SignUpEventDto +import com.nexters.bottles.app.auth.event.DeleteUserEventDto +import com.nexters.bottles.app.auth.event.SignUpEventDto import com.nexters.bottles.api.auth.facade.dto.AppleRevokeResponse import com.nexters.bottles.api.auth.facade.dto.AppleSignInUpRequest import com.nexters.bottles.api.auth.facade.dto.AppleSignInUpResponse diff --git a/api/src/main/kotlin/com/nexters/bottles/api/auth/event/AuthApiEventListener.kt b/app/src/main/kotlin/com/nexters/bottles/app/auth/event/AuthApiEventListener.kt similarity index 93% rename from api/src/main/kotlin/com/nexters/bottles/api/auth/event/AuthApiEventListener.kt rename to app/src/main/kotlin/com/nexters/bottles/app/auth/event/AuthApiEventListener.kt index 1d3e80ca..47573387 100644 --- a/api/src/main/kotlin/com/nexters/bottles/api/auth/event/AuthApiEventListener.kt +++ b/app/src/main/kotlin/com/nexters/bottles/app/auth/event/AuthApiEventListener.kt @@ -1,6 +1,5 @@ -package com.nexters.bottles.api.auth.event +package com.nexters.bottles.app.auth.event -import com.nexters.bottles.api.auth.event.dto.SignUpEventDto import com.nexters.bottles.app.notification.component.FcmClient import com.nexters.bottles.app.notification.component.dto.FcmNotification import com.nexters.bottles.app.notification.service.FcmTokenService diff --git a/api/src/main/kotlin/com/nexters/bottles/api/auth/component/event/DeleteUserEventDto.kt b/app/src/main/kotlin/com/nexters/bottles/app/auth/event/DeleteUserEventDto.kt similarity index 61% rename from api/src/main/kotlin/com/nexters/bottles/api/auth/component/event/DeleteUserEventDto.kt rename to app/src/main/kotlin/com/nexters/bottles/app/auth/event/DeleteUserEventDto.kt index 200347ed..0676485b 100644 --- a/api/src/main/kotlin/com/nexters/bottles/api/auth/component/event/DeleteUserEventDto.kt +++ b/app/src/main/kotlin/com/nexters/bottles/app/auth/event/DeleteUserEventDto.kt @@ -1,4 +1,4 @@ -package com.nexters.bottles.api.auth.component.event +package com.nexters.bottles.app.auth.event data class DeleteUserEventDto( val userId: Long, diff --git a/api/src/main/kotlin/com/nexters/bottles/api/auth/event/dto/SignUpEventDto.kt b/app/src/main/kotlin/com/nexters/bottles/app/auth/event/SignUpEventDto.kt similarity index 64% rename from api/src/main/kotlin/com/nexters/bottles/api/auth/event/dto/SignUpEventDto.kt rename to app/src/main/kotlin/com/nexters/bottles/app/auth/event/SignUpEventDto.kt index 1b213be5..72b0350f 100644 --- a/api/src/main/kotlin/com/nexters/bottles/api/auth/event/dto/SignUpEventDto.kt +++ b/app/src/main/kotlin/com/nexters/bottles/app/auth/event/SignUpEventDto.kt @@ -1,4 +1,4 @@ -package com.nexters.bottles.api.auth.event.dto +package com.nexters.bottles.app.auth.event class SignUpEventDto( val userName: String? = null, diff --git a/app/src/main/kotlin/com/nexters/bottles/app/user/component/event/UserProfileApplicationEventListener.kt b/app/src/main/kotlin/com/nexters/bottles/app/user/component/event/UserProfileApplicationEventListener.kt index 2220d709..bc8001e8 100644 --- a/app/src/main/kotlin/com/nexters/bottles/app/user/component/event/UserProfileApplicationEventListener.kt +++ b/app/src/main/kotlin/com/nexters/bottles/app/user/component/event/UserProfileApplicationEventListener.kt @@ -1,9 +1,9 @@ package com.nexters.bottles.app.user.component.event +import com.nexters.bottles.app.auth.event.SignUpEventDto import com.nexters.bottles.app.bottle.service.BottleHistoryService import com.nexters.bottles.app.bottle.service.BottleService import com.nexters.bottles.app.common.component.FileService -import com.nexters.bottles.app.user.component.event.dto.IntroductionSaveEventDto import com.nexters.bottles.app.user.component.event.dto.UploadImageEventDto import com.nexters.bottles.app.user.service.UserService import org.springframework.scheduling.annotation.Async @@ -20,7 +20,7 @@ class UserProfileApplicationEventListener( @Async @TransactionalEventListener - fun handleCustomEvent(event: IntroductionSaveEventDto) { + fun handleCustomEvent(event: SignUpEventDto) { var savedBottles = bottleService.matchFirstRandomBottle(event.userId, 3) savedBottles.forEach { bottleHistoryService.saveMatchingHistory(sourceUserId = it.sourceUser.id, targetUserId = it.targetUser.id) diff --git a/app/src/main/kotlin/com/nexters/bottles/app/user/component/event/dto/IntroductionSaveEventDto.kt b/app/src/main/kotlin/com/nexters/bottles/app/user/component/event/dto/IntroductionSaveEventDto.kt deleted file mode 100644 index dda5b782..00000000 --- a/app/src/main/kotlin/com/nexters/bottles/app/user/component/event/dto/IntroductionSaveEventDto.kt +++ /dev/null @@ -1,6 +0,0 @@ -package com.nexters.bottles.app.user.component.event.dto - -data class IntroductionSaveEventDto( - val userId: Long, -) { -} diff --git a/app/src/main/kotlin/com/nexters/bottles/app/user/service/UserProfileService.kt b/app/src/main/kotlin/com/nexters/bottles/app/user/service/UserProfileService.kt index 91154e73..a366db59 100644 --- a/app/src/main/kotlin/com/nexters/bottles/app/user/service/UserProfileService.kt +++ b/app/src/main/kotlin/com/nexters/bottles/app/user/service/UserProfileService.kt @@ -1,6 +1,5 @@ package com.nexters.bottles.app.user.service -import com.nexters.bottles.app.user.component.event.dto.IntroductionSaveEventDto import com.nexters.bottles.app.user.component.event.dto.UploadImageEventDto import com.nexters.bottles.app.user.domain.QuestionAndAnswer import com.nexters.bottles.app.user.domain.User @@ -43,13 +42,7 @@ class UserProfileService( fun saveIntroduction(userId: Long, introduction: List, firstMatchingCount: Int) { val user = userRepository.findByIdOrNull(userId) ?: throw IllegalStateException("회원가입 상태를 문의해주세요") profileRepository.findByUserId(user.id)?.let { - val isFirstRegisterIntroduction = it.introduction.isEmpty() it.introduction = introduction - if (isFirstRegisterIntroduction) { - applicationEventPublisher.publishEvent( - IntroductionSaveEventDto(userId = userId) - ) - } } ?: run { profileRepository.save( UserProfile(