-
Notifications
You must be signed in to change notification settings - Fork 0
[Fix] createAndDeleteScrap시 스크랩 전체 개수도 반환 #135
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/main/java/org/runnect/server/scrap/dto/response/CreateAndDeleteScrapResponseDto.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| package org.runnect.server.scrap.dto.response; | ||
|
|
||
| import lombok.AccessLevel; | ||
| import lombok.AllArgsConstructor; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| @Getter | ||
| @NoArgsConstructor(access = AccessLevel.PRIVATE) | ||
| @AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
| public class CreateAndDeleteScrapResponseDto { | ||
| private Long scrapCount; | ||
|
|
||
| public static CreateAndDeleteScrapResponseDto of (Long scrapCount) { | ||
| return new CreateAndDeleteScrapResponseDto(scrapCount); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
pulicCourse entity에 아래와같은 칼럼이 있어서 위에서 publicCourse 가져올때 이미 스크랩카운트 가지고 있어요. 그거 쓰는게 더 편할듯해요
Uh oh!
There was an error while loading. Please reload this page.
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.
오옷 몰랐씀다!!
근데 방금 말씀하신 getScrapCount로 가져오는 방식으로 바꿔서 테스트를 해봤는데 publicCourse객체를 스크랩 하기 전에 findById로 찾아오고 -> 스크랩 생성/취소-> 그 객체에 getScrapCount를 했을 때, 이미 생성해둔 객체에 getScrapCount를 하는 로직이라 스크랩생성/취소한게 반영이 안되네요 ㅠㅜ 그래서 말씀해주신 방식을 사용하려면 publicCourse객체를 스크랩 생성/취소 후 새로 findById하는 방식을 사용하거나 아니면 생성/취소에 따라 getScrapCount에 +-1을 해주는 방식을 써야할 것 같습니다!! 지금 코드 그대로 가는 방법도 있구~.~
근데 개인적으로 +-1 해주는게 디비 접근을 제일 적게 해서 괜찮을 것 같기도 한데..? 어떤게 좋을까유
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.
아 그렇네 이미 publicCourse 가져오고 나서 scrap update 구나!! 기존로직 그대로 가도 좋을것같아요!