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

[BE] feat: 리뷰 단건 조회 API 업데이트 #294

Merged
merged 20 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
ee994ea
feat: 응답 객체 추가
donghoony Aug 10, 2024
de26cc7
feat: 객체 생성자, EqualsAndHashCode, 중간 테이블 설정 수정
donghoony Aug 10, 2024
8fafdaf
feat: 선택 조건에 따른 조회 가시성 기능
donghoony Aug 10, 2024
6c1c4a9
feat: 템플릿, 섹션 저장소, 섹션 순서대로 불러오기
donghoony Aug 10, 2024
747278d
feat: 질문 저장소에서 순서대로 질문 불러오기
donghoony Aug 10, 2024
0657ade
feat: 옵션 저장소, 선택 항목을 리뷰/질문으로 필터링
donghoony Aug 10, 2024
9e719c0
style: apply code convention
donghoony Aug 10, 2024
5ab81c3
feat: 서술형 질문 일급 컬렉션
donghoony Aug 10, 2024
56be08c
feat: `CollectionTable` 삭제, `OneToMany` + `JoinColumn` 사용
donghoony Aug 10, 2024
f8ee4dd
feat: 리뷰 단건 조회
donghoony Aug 10, 2024
13c459b
refactor: 클래스명 명확하게 수정
donghoony Aug 10, 2024
1572be4
feat: API 연동, V2로 적용
donghoony Aug 10, 2024
8ec2e0f
feat: 만들어진 시각 추가
donghoony Aug 11, 2024
c3b3788
style: apply code convention
donghoony Aug 11, 2024
e29150a
refactor: 예외 수정
donghoony Aug 11, 2024
6241cdc
refactor: 쿼리 multiline string으로 수정
donghoony Aug 11, 2024
93aec4d
refactor: 예외명 명확하게 수정
donghoony Aug 11, 2024
498d28d
refactor: 클래스명 통일
donghoony Aug 11, 2024
7f53e68
chore: resolve conflict
donghoony Aug 11, 2024
cd44cf4
refactor: CollectionTable를 삭제하고 다대일 연관관계 수정을 적용
skylar1220 Aug 11, 2024
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
4 changes: 4 additions & 0 deletions backend/src/main/java/reviewme/template/domain/Section.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,8 @@ public Section(VisibleType visibleType, List<Long> questionIds,
this.header = header;
this.position = position;
}

public boolean isVisibleBySelectedOptionIds(Collection<Long> selectedOptionIds) {
return visibleType == VisibleType.ALWAYS || selectedOptionIds.contains(onSelectedOptionId);
}
nayonsoso marked this conversation as resolved.
Show resolved Hide resolved
}
45 changes: 45 additions & 0 deletions backend/src/test/java/reviewme/template/domain/SectionTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package reviewme.template.domain;

import static org.assertj.core.api.Assertions.assertThat;

import java.util.List;
import org.junit.jupiter.api.Test;

class SectionTest {

@Test
void 조건_옵션을_선택하면_섹션이_보인다() {
// given
Section section = new Section(VisibleType.CONDITIONAL, List.of(), 1L, "1", 1);

// when
boolean actual = section.isVisibleBySelectedOptionIds(List.of(1L, 2L, 3L));

// then
assertThat(actual).isTrue();
}

@Test
void 조건_옵션을_선택하지_않으면_섹션이_보이지_않는다() {
// given
Section section = new Section(VisibleType.CONDITIONAL, List.of(), 1L, "1", 1);

// when
boolean actual = section.isVisibleBySelectedOptionIds(List.of(4L, 5L, 6L));

// then
assertThat(actual).isFalse();
}

@Test
void 타입이_ALWAYS라면_조건과_상관없이_모두_보인다() {
// given
Section section = new Section(VisibleType.ALWAYS, List.of(), null, "1", 1);

// when
boolean actual = section.isVisibleBySelectedOptionIds(List.of());

// then
assertThat(actual).isTrue();
}
}