-
Notifications
You must be signed in to change notification settings - Fork 2
[Artist] 아티스트 찜하기 #110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Artist] 아티스트 찜하기 #110
Changes from 1 commit
7f47452
8d44971
6361f19
ee37d98
8e7c68d
eb4ee63
99479a8
80348ba
0b90afc
a7c2385
baa7a3f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,14 +14,15 @@ | |
| import com.back.web7_9_codecrete_be.global.error.code.ArtistErrorCode; | ||
| import com.back.web7_9_codecrete_be.global.error.exception.BusinessException; | ||
| import com.back.web7_9_codecrete_be.global.rq.Rq; | ||
| import lombok.AccessLevel; | ||
| import org.springframework.transaction.annotation.Transactional; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.stereotype.Service; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| @Service | ||
| @RequiredArgsConstructor | ||
| @RequiredArgsConstructor(access = AccessLevel.PROTECTED) | ||
| public class ArtistService { | ||
|
|
||
| private final SpotifyService spotifyService; | ||
|
|
@@ -141,4 +142,15 @@ public void likeArtist(Long artistId) { | |
| artist.increaseLikeCount(); | ||
| } | ||
|
|
||
| @Transactional | ||
| public void deleteLikeArtist(Long artistId) { | ||
| User user = rq.getUser(); | ||
| Artist artist = artistRepository.findById(artistId) | ||
| .orElseThrow(() -> new BusinessException(ArtistErrorCode.ARTIST_NOT_FOUND)); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. artist 찾아오는 부분은 좋아요 / 좋아요 삭제 부분에서 공통적으로 처리되는 부분이니 메소드로 빼도 좋을 것 같습니다.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 넵 수정하겠습니다!! 팁 알려주셔서 감사합니당
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
저도 꿀팁 하나 얻어갑니다! |
||
| ArtistLike likes = artistLikeRepository.findByArtistAndUser(artist, user) | ||
| .orElseThrow(() -> new BusinessException(ArtistErrorCode.LIKES_NOT_FOUND)); | ||
| artistLikeRepository.delete(likes); | ||
| artist.decreaseLikeCount(); | ||
| } | ||
|
|
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Auditing 사용중이라서 위에 칼럼쪽에 createdate 어노테이션 사용하시면 자동으로 주입될 것 같습니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넵 수정하겠습니다!!