Skip to content

Commit

Permalink
feat: SocialUnlinkClientManager로 소셜 연결 해지 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
belljun3395 committed May 19, 2024
1 parent 639b79c commit b065270
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.walking.member.api.usecase

import com.walking.data.entity.member.MemberEntity
import com.walking.image.service.minio.MinioRemoveImageService
import com.walking.member.api.client.unlink.SocialUnlinkClientManager
import com.walking.member.api.dao.MemberDao
import com.walking.member.api.usecase.dto.response.DeleteMemberUseCaseResponse
import org.springframework.cache.annotation.CacheEvict
Expand All @@ -11,14 +12,19 @@ import org.springframework.transaction.annotation.Transactional
@Service
class DeleteMemberUseCase(
private val memberRepository: MemberDao,
private val removeImageService: MinioRemoveImageService
private val removeImageService: MinioRemoveImageService,
private val unlinkClientManager: SocialUnlinkClientManager
) {
@Transactional
@CacheEvict(key = "#id", cacheManager = "memberApiCacheManager", cacheNames = ["member-profile-url"])
fun execute(id: Long): DeleteMemberUseCaseResponse {
val member = memberRepository.findById(id) ?: throw IllegalArgumentException("Member not found")
val deletedMember = withdrawMember(member)
removeImageService.execute(deletedMember.profile)
unlinkClientManager.execute(
deletedMember.certificationSubject.name,
deletedMember.certificationId
)

return DeleteMemberUseCaseResponse(deletedMember.id, deletedMember.updatedAt)
}
Expand Down

0 comments on commit b065270

Please sign in to comment.