-
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
pr feat: 우리동네(함께해요, 소통해요) CRUD api 구현 #35
Conversation
"api/v1"
Image => CommunityImage
Common에서 가져다 쓰기
Delete 제거
ImageResponse => CartImageResponse / ImageResponse => CommunityImageResponse
ImageRepository => CartImageRepository / ImageRepository => CommunityImageRepository
ImageService => CommunityImageService
CartPostController, CommunityPostController
총가격, 상품관련링크, 채팅링크, 참여인원, 거래희망장소
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.
종근님 수고하셨습니다~ 리팩토링 관련으로 의견 남겨놨습니다.
저랑 코드가 많이 똑같아서 제꺼랑 헷갈리네요 ㅋㅋㅋㅋ 화이팅입니다!
.title(request.getTitle()) | ||
.build(); | ||
} | ||
|
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.
Cart에서 비활성화하는 로직을 @OverRide하면 좋을 것 같습니다.
지금 상속받은 BaseEntity에 있는 비활성화(sofr delete)를 진행하면 CartImage, CartComment는 비활성화가 진행되지 않기 때문입니다.
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.
forEach
사용하여 Cart와 연관된 엔티티들 비활성화하도록 코드 수정했어요~ 좋은 피드백 감사합니다!
@Override
public void deactivate() {
super.deactivate(); // BaseEntity에 정의되어 있는 메소드
this.cartImages.forEach(CartImage::deactivate);
this.reports.forEach(Report::deactivate);
this.cartComments.forEach(CartComment::deactivate);
this.itemUrls.forEach(ItemUrl::deactivate);
}
/* -------------------------------------------- Soft Delete -------------------------------------------- */ | ||
public void delete(final Long postId) { | ||
Cart cart = findCart(postId); | ||
cart.deactivate(); // 비활성화 |
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.
이부분 말씀드린겁니다!
Service에 있는 로직은 그대로 두되, cart에서 deactivate() 메서드를 오버라이드해서 Cart와 연관되어있는 Image, Comment등 같이 비활성화하면 좋을 것 같네요
src/main/java/com/api/ttoklip/domain/town/community/post/entity/Community.java
Outdated
Show resolved
Hide resolved
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class CartPostService { |
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.
지금 카테고리별 조회, 단건 조회는 로직을 안만드신걸까요~?
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 number and Link
Summary
공통 댓글 구현, 공통 신고 구현
질문해요 게시글 작성, 게시글 단건 조회, 댓글 생성, 댓글 수정, 댓글 삭제(soft delete, Report 때문)
PR Type
Other Information
'함께해요'와 '소통해요' 게시판의 겹치는 메인 기능들은 구현을 한 상태입니다.
'함께해요'의 추가 기능들은 이어서 진행하겠습니다.
Common Type
branch