Skip to content

Commit

Permalink
Merge pull request #281 from team-haribo/280-feat/outing-profile-cach…
Browse files Browse the repository at this point in the history
…e-delete

# 280 feat/outing profile cache delete
  • Loading branch information
KimGyeongsuuu authored Jul 10, 2024
2 parents 7190874 + f19c004 commit 1a8f0ad
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
package com.goms.v2.domain.studentCouncil.usecase

import com.goms.v2.common.annotation.UseCaseWithTransaction
import com.goms.v2.common.util.AccountUtil
import com.goms.v2.domain.auth.exception.AccountNotFoundException
import com.goms.v2.repository.account.AccountRepository
import com.goms.v2.repository.outing.OutingRepository
import org.springframework.cache.annotation.CacheEvict
import java.util.*

@UseCaseWithTransaction
class DeleteOutingUseCase(
private val accountRepository: AccountRepository,
private val outingRepository: OutingRepository
private val outingRepository: OutingRepository,
private val accountUtil: AccountUtil
) {

@CacheEvict(
value = ["userProfiles"],
key = "#accountIdx",
cacheManager = "contentCacheManager"
)
fun execute(accountIdx: UUID) {
val account = accountRepository.findByIdOrNull(accountIdx) ?: throw AccountNotFoundException()
outingRepository.deleteByAccountIdx(account.idx)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.goms.v2.domain.studentCouncil

import com.goms.v2.common.AnyValueObjectGenerator
import com.goms.v2.common.util.AccountUtil
import com.goms.v2.domain.account.Account
import com.goms.v2.domain.auth.exception.AccountNotFoundException
import com.goms.v2.domain.studentCouncil.usecase.DeleteOutingUseCase
Expand All @@ -17,7 +18,8 @@ class DeleteOutingUseCaseTest : BehaviorSpec({

val accountRepository = mockk<AccountRepository>()
val outingRepository = mockk<OutingRepository>()
val deleteOutingUseCase = DeleteOutingUseCase(accountRepository, outingRepository)
val accountUtil = mockk<AccountUtil>()
val deleteOutingUseCase = DeleteOutingUseCase(accountRepository, outingRepository, accountUtil)

Given("accountIdx가 주어졌을때") {
val accountIdx = UUID.randomUUID()
Expand Down

0 comments on commit 1a8f0ad

Please sign in to comment.