-
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
🔀 :: (#220) 게시글, 댓글 soft delete 추가 #108
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.
굳굳
@@ -23,4 +23,6 @@ public class Comment { | |||
private final LocalDateTime createAt; | |||
|
|||
private final LocalDateTime updatedAt; | |||
|
|||
private final Boolean isDeleted = false; |
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.
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) |
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.
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; |
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.
p3) nullable은 false인데 Primitive type으로 설정하는게 좋을 것 같습니다.
@@ -42,11 +42,18 @@ public class FeedEntity extends BaseUUIDEntity { | |||
@Column(nullable = false) | |||
private String authorityType; |
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.
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; |
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.
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); |
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.
P4) comment.delete()가 더 명확한 것 같습니다!
feedMapper.domainToEntity(feed) | ||
); | ||
FeedEntity feedEntity = getFeedEntityById(feed.getId()); | ||
feedEntity.updateIsDeleted(true); |
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.
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)) |
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.
Q) isDeleted가 true이면 soft-delete된 값일텐데, 이건 따로 BooleanExpression으로 빼서 관리하는게 어떤가요?
No description provided.