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

🔀 :: (#220) 게시글, 댓글 soft delete 추가 #108

Merged
merged 1 commit into from
Aug 18, 2023

Conversation

jyk1029
Copy link
Member

@jyk1029 jyk1029 commented Aug 18, 2023

No description provided.

@jyk1029 jyk1029 added the 리팩토링 리팩토링이 필요함을 나타냅니다. label Aug 18, 2023
@jyk1029 jyk1029 self-assigned this Aug 18, 2023
Copy link
Member

@jeongho1209 jeongho1209 left a comment

Choose a reason for hiding this comment

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

굳굳

@jyk1029 jyk1029 merged commit 99f58ec into main Aug 18, 2023
1 check passed
@jyk1029 jyk1029 deleted the XQU-220-refactor-soft-delete branch August 18, 2023 08:40
@@ -23,4 +23,6 @@ public class Comment {
private final LocalDateTime createAt;

private final LocalDateTime updatedAt;

private final Boolean isDeleted = false;
Copy link
Member

Choose a reason for hiding this comment

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

p4) deleted도 나쁘지않을 것 같네요~

@@ -36,9 +36,16 @@ public class CommentEntity extends BaseUUIDEntity {
@Column(nullable = false)
private LocalDateTime updatedAt;

@Column(columnDefinition = "BIT(1) default 0", nullable = false)
Copy link
Member

Choose a reason for hiding this comment

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

Q) BIT를 사용한 이유가 있나요?

@@ -36,9 +36,16 @@ public class CommentEntity extends BaseUUIDEntity {
@Column(nullable = false)
private LocalDateTime updatedAt;

@Column(columnDefinition = "BIT(1) default 0", nullable = false)
private Boolean isDeleted;
Copy link
Member

Choose a reason for hiding this comment

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

p3) nullable은 false인데 Primitive type으로 설정하는게 좋을 것 같습니다.

@@ -42,11 +42,18 @@ public class FeedEntity extends BaseUUIDEntity {
@Column(nullable = false)
private String authorityType;
Copy link
Member

Choose a reason for hiding this comment

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

Q) Enum Type으로 하지 않은 이유가 있나요?

@@ -42,11 +42,18 @@ public class FeedEntity extends BaseUUIDEntity {
@Column(nullable = false)
private String authorityType;

@Column(columnDefinition = "BIT(1) default 0", nullable = false)
private Boolean isDeleted;
Copy link
Member

Choose a reason for hiding this comment

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

Q) nullable false 인데 primitive 사용하지 않은 이유가 있나요?

@@ -39,7 +39,8 @@ public void saveComment(Comment comment) {

@Override
public void deleteCommentById(UUID commentId) {
commentRepository.deleteById(commentId);
CommentEntity comment = getCommentById(commentId);
comment.updatedIsDeleted(true);
Copy link
Member

Choose a reason for hiding this comment

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

P4) comment.delete()가 더 명확한 것 같습니다!

feedMapper.domainToEntity(feed)
);
FeedEntity feedEntity = getFeedEntityById(feed.getId());
feedEntity.updateIsDeleted(true);
Copy link
Member

Choose a reason for hiding this comment

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

p1) 여기서 manual하게 save해서 update를 해주는게 좋을 것 같습니다

@@ -81,7 +80,7 @@ public FeedPageList queryAllFeedByCategory(UUID categoryId, LocalDateTime time,
.on(feedEntity.id.eq(feedLikeEntity.feedEntity.id))
.leftJoin(commentEntity)
.on(feedEntity.id.eq(commentEntity.feedEntity.id))
.where(expression.and(categoryIdEq(categoryId)))
.where(expression.and(categoryIdEq(categoryId)), feedEntity.isDeleted.eq(false))
Copy link
Member

Choose a reason for hiding this comment

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

Q) isDeleted가 true이면 soft-delete된 값일텐데, 이건 따로 BooleanExpression으로 빼서 관리하는게 어떤가요?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
리팩토링 리팩토링이 필요함을 나타냅니다.
Projects
Status: ✅ 완료됨
Development

Successfully merging this pull request may close these issues.

4 participants