Skip to content

Commit

Permalink
feat: 회원가입 후 바로 3개 받도록 수정 (#560)
Browse files Browse the repository at this point in the history
  • Loading branch information
injoon2019 authored Nov 6, 2024
1 parent ad71348 commit c3bc3c1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ class BottleMatchingRepository(
UsersCanBeMatchedDto(
willMatchUserId = rs.getLong("willMatchUserId"),
willMatchUserGender = rs.getString("willMatchUserGender"),
willMatchCity = rs.getString("city")
)
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
}
Expand Down

0 comments on commit c3bc3c1

Please sign in to comment.