Skip to content
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

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

youngh0
Copy link
Contributor

@youngh0 youngh0 commented Aug 13, 2023

🛠️ Issue

✅ Tasks

  • 태그 생성, 조회, 업데이트 구현했습니다.
  • 관련 api url을 따로 정한게 없어서 제가 임시로 정했습니다.
  • 태그 조회 시 member는 memberId만 일단 받도록 했습니다.

⏰ Time

  • from -> to

📝 Note

@youngh0 youngh0 added the feature 기능 추가 label Aug 13, 2023
@youngh0 youngh0 self-assigned this Aug 13, 2023
Copy link
Member

@HubCreator HubCreator left a 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.*;
Copy link
Member

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")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/tags에 대한 uri가 반복되는데, 클래스단에 @RequestMapping을 붙여 공통된 부분을 처리하는 것은 어떨까요?!?!

Copy link
Collaborator

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);
Copy link
Member

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 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

기본 생성자를 private으로 막아주는 것도 좋을 것 같아요!

Comment on lines +39 to +41
public void deleteTagById(Long tagId) {
tagRepository.deleteById(tagId);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

소프트 딜리트이면 deleteById가 아니라, 해당 태그를 가져와서 isDeleted 부분을 변경 감지를 통해 수정하여, update 쿼리를 날려야할 것 같은데 맞을까요!??!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저는 아마 Tag에 달려있는 deleteSql 때문에 이렇게 해도 업데이트 쿼리 나가는 걸로 알고있어요 !

레오씨의 대답기다리겠습니다.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tag엔티티에 선언한 어노테이션으로 deleted쿼리가 나가면 자동으로 update쿼리가 나갑니다!

Copy link
Collaborator

@jundonghyuk jundonghyuk left a 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);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오우 애초에 저렇게 쓰는법도있군요...

Comment on lines +39 to +41
public void deleteTagById(Long tagId) {
tagRepository.deleteById(tagId);
}
Copy link
Collaborator

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")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

공감합니다

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature 기능 추가
Projects
None yet
Development

Successfully merging this pull request may close these issues.

추억의 이정표 CRUD구현
3 participants