Skip to content

Commit

Permalink
fix: 스터디 조회 시 삭제된 스터디(is_delete = true)도 함께 조회되던 문제 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
JJimini committed Sep 26, 2024
1 parent 00042a6 commit 555e3a8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/main/java/doore/study/domain/Study.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLRestriction;

@Entity
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@SQLRestriction("is_deleted = false")
@SQLDelete(sql = "UPDATE study SET is_deleted = true where id = ?")
public class Study extends BaseEntity {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.jupiter.api.Assertions.assertAll;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.mock;

import doore.helper.IntegrationTest;
Expand Down Expand Up @@ -240,7 +239,7 @@ void setUp() {
void deleteStudy_정상적으로_스터디를_삭제할_수_있다_성공() throws Exception {
studyCommandService.deleteStudy(study.getId(), memberId);
final List<Study> studies = studyRepository.findAll();
assertTrue(studies.get(0).getIsDeleted());
assertThat(studies.size()).isEqualTo(0);
}

@Test
Expand All @@ -254,8 +253,7 @@ void setUp() {
study.getId());

assertThat(beforeCurriculumItems.size()).isEqualTo(2);
assertThat(afterCurriculumItems.get(0).getIsDeleted()).isEqualTo(true);
assertThat(afterCurriculumItems.get(1).getIsDeleted()).isEqualTo(true);
assertThat(afterCurriculumItems.size()).isEqualTo(0);
}

@Test
Expand Down

0 comments on commit 555e3a8

Please sign in to comment.