From 42967edfa9642bc0e70fd6d266a962f822d4bae9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=8F=99=EC=B0=AC?= <129833370+dongchandev@users.noreply.github.com> Date: Wed, 17 Apr 2024 13:29:21 +0900 Subject: [PATCH] fix: like patch api --- .../com/molohala/infinityapi/like/LikeController.kt | 2 +- .../auth/application/service/AuthServiceImpl.kt | 1 + .../infinitycore/like/application/service/LikeService.kt | 9 ++++----- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/infinity-api/src/main/kotlin/com/molohala/infinityapi/like/LikeController.kt b/infinity-api/src/main/kotlin/com/molohala/infinityapi/like/LikeController.kt index 2252a71..dd5662f 100644 --- a/infinity-api/src/main/kotlin/com/molohala/infinityapi/like/LikeController.kt +++ b/infinity-api/src/main/kotlin/com/molohala/infinityapi/like/LikeController.kt @@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController class LikeController( private val likeService: LikeService ) { - @PatchMapping("/{id}") + @PatchMapping("{id}") fun patch( @PathVariable("id") id: Long ): Response { diff --git a/infinity-core/src/main/kotlin/com/molohala/infinitycore/auth/application/service/AuthServiceImpl.kt b/infinity-core/src/main/kotlin/com/molohala/infinitycore/auth/application/service/AuthServiceImpl.kt index 1906e11..07f4e7c 100644 --- a/infinity-core/src/main/kotlin/com/molohala/infinitycore/auth/application/service/AuthServiceImpl.kt +++ b/infinity-core/src/main/kotlin/com/molohala/infinitycore/auth/application/service/AuthServiceImpl.kt @@ -54,6 +54,7 @@ class AuthServiceImpl( issueJwtToken.reissueToken(reissueTokenReq.refreshToken) override fun test(email: String): Token { + println("엄") val member:Member? = memberJpaRepository.findByEmail(email) return issueJwtToken.issueToken(email, member!!.role) } diff --git a/infinity-core/src/main/kotlin/com/molohala/infinitycore/like/application/service/LikeService.kt b/infinity-core/src/main/kotlin/com/molohala/infinitycore/like/application/service/LikeService.kt index d54115c..c2f293d 100644 --- a/infinity-core/src/main/kotlin/com/molohala/infinitycore/like/application/service/LikeService.kt +++ b/infinity-core/src/main/kotlin/com/molohala/infinitycore/like/application/service/LikeService.kt @@ -22,14 +22,13 @@ class LikeService( val isExist:Boolean = queryLikeRepository .existsByCommunityIdAndMemberId(communityId,member.id!!) if(isExist){ + likeJpaRepository.delete( + queryLikeRepository.findByCommunityIdAndMemberId(communityId,member.id) + ) + }else{ likeJpaRepository.save( Like(communityId, member.id) ) - }else{ - likeJpaRepository.delete( - queryLikeRepository - .findByCommunityIdAndMemberId(communityId,member.id) - ) } }