diff --git a/idle-application/src/main/kotlin/com/swm/idle/application/jobposting/domain/JobPostingFavoriteService.kt b/idle-application/src/main/kotlin/com/swm/idle/application/jobposting/domain/JobPostingFavoriteService.kt index 729e9dff..305a3bee 100644 --- a/idle-application/src/main/kotlin/com/swm/idle/application/jobposting/domain/JobPostingFavoriteService.kt +++ b/idle-application/src/main/kotlin/com/swm/idle/application/jobposting/domain/JobPostingFavoriteService.kt @@ -23,15 +23,15 @@ class JobPostingFavoriteService( val jobPostingFavorite = jobPostingFavoriteJpaRepository.findByJobPostingIdAndCarerId( jobPostingId = jobPostingId, carerId = carerId - ) ?: jobPostingFavoriteJpaRepository.save( + )?.let { + it.active() + } ?: jobPostingFavoriteJpaRepository.save( JobPostingFavorite( carerId = carerId, jobPostingId = jobPostingId, jobPostingType = jobPostingType, ) ) - - jobPostingFavorite.active() } @Transactional diff --git a/idle-application/src/main/kotlin/com/swm/idle/application/jobposting/facade/JobPostingFavoriteFacadeService.kt b/idle-application/src/main/kotlin/com/swm/idle/application/jobposting/facade/JobPostingFavoriteFacadeService.kt index 90daca5f..f7b2c640 100644 --- a/idle-application/src/main/kotlin/com/swm/idle/application/jobposting/facade/JobPostingFavoriteFacadeService.kt +++ b/idle-application/src/main/kotlin/com/swm/idle/application/jobposting/facade/JobPostingFavoriteFacadeService.kt @@ -5,6 +5,7 @@ import com.swm.idle.application.jobposting.domain.JobPostingService import com.swm.idle.application.user.carer.domain.CarerService import com.swm.idle.domain.jobposting.enums.JobPostingType import org.springframework.stereotype.Service +import org.springframework.transaction.annotation.Transactional import java.util.* @Service @@ -14,6 +15,7 @@ data class JobPostingFavoriteFacadeService( private val jobPostingService: JobPostingService, ) { + @Transactional fun createJobPostingFavorite( jobPostingId: UUID, carerId: UUID, @@ -31,6 +33,7 @@ data class JobPostingFavoriteFacadeService( ) } + @Transactional fun deleteJobPostingFavorite( jobPostingId: UUID, carerId: UUID,