From c3bc3c1268cf82a00659cf2ff6f1a3f627026d15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B8=EC=A4=80?= Date: Thu, 7 Nov 2024 01:03:12 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=ED=9A=8C=EC=9B=90=EA=B0=80=EC=9E=85=20?= =?UTF-8?q?=ED=9B=84=20=EB=B0=94=EB=A1=9C=203=EA=B0=9C=20=EB=B0=9B?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95=20(#560)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/nexters/bottles/api/auth/facade/AuthFacade.kt | 1 + .../app/bottle/repository/BottleMatchingRepository.kt | 1 - .../app/bottle/repository/dto/UsersCanBeMatchedDto.kt | 2 +- .../event/UserProfileApplicationEventListener.kt | 10 ++++++++-- 4 files changed, 10 insertions(+), 4 deletions(-) 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 7598fdf5..7ace0c42 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 @@ -87,6 +87,7 @@ class AuthFacade( hasCompleteUserProfile = userProfile != null, hasCompleteIntroduction = userProfile?.hasCompleteIntroduction() ?: false, ).also { + log.info { "isSignUp: ${signInUpDto.isSignUp}" } if (signInUpDto.isSignUp) { applicationEventPublisher.publishEvent( SignUpEventDto( 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 45a088df..5fe44401 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 @@ -95,7 +95,6 @@ class BottleMatchingRepository( UsersCanBeMatchedDto( willMatchUserId = rs.getLong("willMatchUserId"), willMatchUserGender = rs.getString("willMatchUserGender"), - willMatchCity = rs.getString("city") ) } ) diff --git a/app/src/main/kotlin/com/nexters/bottles/app/bottle/repository/dto/UsersCanBeMatchedDto.kt b/app/src/main/kotlin/com/nexters/bottles/app/bottle/repository/dto/UsersCanBeMatchedDto.kt index f229d96e..8d75e160 100644 --- a/app/src/main/kotlin/com/nexters/bottles/app/bottle/repository/dto/UsersCanBeMatchedDto.kt +++ b/app/src/main/kotlin/com/nexters/bottles/app/bottle/repository/dto/UsersCanBeMatchedDto.kt @@ -3,7 +3,7 @@ package com.nexters.bottles.app.bottle.repository.dto data class UsersCanBeMatchedDto( val willMatchUserId: Long, val willMatchUserGender: String, - val willMatchCity: String, + val willMatchCity: String? = null, ) data class UserProfileSelectDto( 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 bc8001e8..e2db7776 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 @@ -6,6 +6,8 @@ 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.UploadImageEventDto import com.nexters.bottles.app.user.service.UserService +import mu.KotlinLogging +import org.springframework.context.event.EventListener import org.springframework.scheduling.annotation.Async import org.springframework.stereotype.Component import org.springframework.transaction.event.TransactionalEventListener @@ -18,10 +20,14 @@ class UserProfileApplicationEventListener( private val fileService: FileService ) { + private val log = KotlinLogging.logger { } + @Async - @TransactionalEventListener + @EventListener fun handleCustomEvent(event: SignUpEventDto) { - var savedBottles = bottleService.matchFirstRandomBottle(event.userId, 3) + log.info { "SignUpEventDto" } + var savedBottles = bottleService.matchFirstRandomBottle(userId = event.userId, count = 3) + log.info { "savedBottles=$savedBottles" } savedBottles.forEach { bottleHistoryService.saveMatchingHistory(sourceUserId = it.sourceUser.id, targetUserId = it.targetUser.id) }