Skip to content

Commit

Permalink
feat: 자기소개 작성시 주는 보틀 삭제
Browse files Browse the repository at this point in the history
  • Loading branch information
injoon2019 committed Nov 6, 2024
1 parent 0c35548 commit 703f637
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -43,13 +42,7 @@ class UserProfileService(
fun saveIntroduction(userId: Long, introduction: List<QuestionAndAnswer>, 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(
Expand Down

0 comments on commit 703f637

Please sign in to comment.