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

[BUG] 좋아요 반 정규화로 인한 템플릿 좋아요 시 해당 템플릿의 ModifiedAt 변경 문제 #927

Merged
merged 11 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,4 @@ private void postLoad() {
public void markUnModified() {
isModified = false;
}

public void markModified() {
isModified = true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ public String getThumbnailContent() {
}

public void updateSourceCode(String filename, String content, Integer ordinal) {
template.markModifiedSourceCodes();
this.filename = filename;
this.content = content;
this.ordinal = ordinal;
Expand Down
7 changes: 0 additions & 7 deletions backend/src/main/java/codezap/template/domain/Template.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ public Template(Member member, String title, String description, Category catego
}

public void updateTemplate(String title, String description, Category category, Visibility visibility) {
if (this.title.equals(title) && this.description.equals(description)) {
markUnModified();
}
this.title = title;
this.description = description;
this.category = category;
Expand All @@ -102,8 +99,4 @@ public void cancelLike() {
}
this.likesCount--;
}

public void markModifiedSourceCodes() {
markModified();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -254,31 +254,7 @@ void updateTemplateSuccess() {
}

@Test
@DisplayName("템플릿 수정 성공 : 일부 데이터가 수정됬을 경우 modifiedAt 변경되지 않음")
void updateTemplateVisibilitySuccessNotChangeModifiedAt() {
var member = memberRepository.save(MemberFixture.getFirstMember());
var category = categoryRepository.save(CategoryFixture.getFirstCategory());
var otherCategory = categoryRepository.save(CategoryFixture.get(member));
var template = templateRepository.save(TemplateFixture.get(member, category));
var beforeModifiedAt = template.getModifiedAt();
var request = new UpdateTemplateRequest(
template.getTitle(),
template.getDescription(),
List.of(),
List.of(),
List.of(),
otherCategory.getId(),
List.of(),
Visibility.PRIVATE
);
sut.update(member, template.getId(), request, category);
entityManager.flush();

assertThat(template.getModifiedAt()).isEqualTo(beforeModifiedAt);
}

@Test
@DisplayName("템플릿 수정 성공 : 일부 데이터가 수정됬을 경우 modifiedAt 변경")
@DisplayName("템플릿 수정 성공 : 데이터가 수정됬을 경우 modifiedAt 변경")
Copy link
Contributor

Choose a reason for hiding this comment

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

맞춤법 실수가 있어요..!!

void updateTemplateSuccessChangeModifiedAt() {
var member = memberRepository.save(MemberFixture.getFirstMember());
var category = categoryRepository.save(CategoryFixture.getFirstCategory());
Expand Down
Loading