Skip to content

Commit

Permalink
톡픽 엔티티에 수정 여부 필드 추가 (#699)
Browse files Browse the repository at this point in the history
* feat: 톡픽 엔티티에 수정 여부(isUpdated) 필드 추가

* refactor: 톡픽 엔티티의 수정 여부 필드명 변경

isUpdated -> isEdited
  • Loading branch information
Hanjaemo authored Nov 8, 2024
1 parent 965b660 commit b75d490
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/main/java/balancetalk/talkpick/domain/TalkPick.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ public class TalkPick extends BaseTimeEntity {

private LocalDateTime editedAt;

private boolean isEdited;

@Enumerated(value = EnumType.STRING)
private ViewStatus viewStatus = ViewStatus.NORMAL;

Expand Down Expand Up @@ -106,14 +108,15 @@ public void update(TalkPick newTalkPick) {
this.optionB = newTalkPick.getOptionB();
this.sourceUrl = newTalkPick.getSourceUrl();
this.editedAt = LocalDateTime.now();
this.isEdited = true;
}

public boolean matchesId(long id) {
return this.id == id;
}

public boolean isEdited() {
return editedAt != null;
return isEdited;
}

public void updateSummary(Summary newSummary) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/balancetalk/talkpick/dto/TalkPickDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public static class TalkPickDetailResponse {
private LocalDate createdAt;

@Schema(description = "수정 여부", example = "true")
private Boolean isUpdated;
private Boolean isEdited;

public static TalkPickDetailResponse from(TalkPick entity,
List<String> imgUrls,
Expand All @@ -128,7 +128,7 @@ public static TalkPickDetailResponse from(TalkPick entity,
.votedOption(votedOption)
.writer(entity.getWriterNickname())
.createdAt(entity.getCreatedAt().toLocalDate())
.isUpdated(entity.isEdited())
.isEdited(entity.isEdited())
.build();
}
}
Expand Down

0 comments on commit b75d490

Please sign in to comment.