-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: 태그 생성, 조회, 업데이트 구현 #17
base: develop
Are you sure you want to change the base?
Conversation
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.
고생하셨습니다 레오 !!
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.*; |
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.
인텔리제이 포맷팅 설정이 잘못된 것 같아요!!
|
||
private final TagService tagService; | ||
|
||
@PostMapping("/tags") |
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.
/tags
에 대한 uri가 반복되는데, 클래스단에 @RequestMapping
을 붙여 공통된 부분을 처리하는 것은 어떨까요?!?!
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.
공감합니다
|
||
public interface TagRepository extends JpaRepository<Tag, Long> { | ||
|
||
List<Tag> findTagsByMemberIdAndDeletedIsFalse(Long memberId); |
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.
오.. 쿼리 메서드로 소프트 딜리트를 이렇게 핸들링할 수 있군여! 따봉
|
||
@AllArgsConstructor | ||
@Getter | ||
public class TagFindResponseDto { |
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.
기본 생성자를 private으로 막아주는 것도 좋을 것 같아요!
public void deleteTagById(Long tagId) { | ||
tagRepository.deleteById(tagId); | ||
} |
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.
소프트 딜리트이면 deleteById가 아니라, 해당 태그를 가져와서 isDeleted 부분을 변경 감지를 통해 수정하여, update 쿼리를 날려야할 것 같은데 맞을까요!??!
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.
저는 아마 Tag
에 달려있는 deleteSql 때문에 이렇게 해도 업데이트 쿼리 나가는 걸로 알고있어요 !
레오씨의 대답기다리겠습니다.
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.
Tag엔티티에 선언한 어노테이션으로 deleted쿼리가 나가면 자동으로 update쿼리가 나갑니다!
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.
고생하셨어요 커멘트남김요 !
|
||
public interface TagRepository extends JpaRepository<Tag, Long> { | ||
|
||
List<Tag> findTagsByMemberIdAndDeletedIsFalse(Long memberId); |
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.
오우 애초에 저렇게 쓰는법도있군요...
public void deleteTagById(Long tagId) { | ||
tagRepository.deleteById(tagId); | ||
} |
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.
저는 아마 Tag
에 달려있는 deleteSql 때문에 이렇게 해도 업데이트 쿼리 나가는 걸로 알고있어요 !
레오씨의 대답기다리겠습니다.
|
||
private final TagService tagService; | ||
|
||
@PostMapping("/tags") |
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.
공감합니다
🛠️ Issue
✅ Tasks
⏰ Time
📝 Note