Skip to content

Commit

Permalink
refactor: like delete 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
pjm2571 committed Oct 25, 2024
1 parent f9c9e94 commit 6670ab7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
import org.springframework.http.RequestEntity;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
Expand All @@ -29,9 +31,9 @@ public ResponseEntity<?> saveLike(

@DeleteMapping("/like")
public ResponseEntity<?> deleteLike(
@RequestBody LikeCreateRequest request
@PathVariable Long tilId
) {
LikeDeleteResponse likeDeleteResponse = likeService.delete(request);
LikeDeleteResponse likeDeleteResponse = likeService.delete(tilId);

return ResponseEntity.ok(likeDeleteResponse);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ public LikeCreateResponse save(LikeCreateRequest request) {
}

@Transactional
public LikeDeleteResponse delete(LikeCreateRequest request) {
public LikeDeleteResponse delete(Long tilId) {
// 1) 현재 로그인 된 멤버의 ID를 가져온다.
Member loggedInMember = memberResolver.getCurrentMember();

// 2) tilRepo에서 requestTilId에 해당하는 til 조회
Til til = tilRepository.findById(request.getTilId())
Til til = tilRepository.findById(tilId)
.orElseThrow(TilIdNotFoundException::new);


Expand Down

0 comments on commit 6670ab7

Please sign in to comment.