-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BE] feat: 리뷰에 필요한 정보 조회 기능 추가 (#103)
* test: QuestionTestFixture 생성 * feat: 모든 리뷰 문항을 조회하는 기능 구현 * feat: 모든 키워드를 조회하는 기능 구현 * test: ReviewerGroupFixture 생성 * feat: 리뷰 생성 시 필요한 리뷰어 그룹 정보를 조회하는 기능 구현 * feat: 리뷰 생성 시 필요한 정보를 조회하는 기능 구현 * refactor: @servicetest 적용 * refactor: swagger 적용 * refactor: 필드명 변경 * style: 개행 추가 * refactor: 날짜 형식 변경 * test: import문 제거 * refactor: ReviewCreationResponse 패키지 변경 * refactor: readOnly 트랜잭션 적용 * fix: 리뷰어 중복 검증 임시 제거 --------- Co-authored-by: donghoony <[email protected]>
- Loading branch information
1 parent
8706a80
commit 9be248e
Showing
18 changed files
with
308 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,6 @@ public record KeywordResponse( | |
long id, | ||
|
||
@Schema(description = "키워드명") | ||
String detail | ||
String content | ||
) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
backend/src/main/java/reviewme/member/dto/response/ReviewCreationReviewerGroupResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package reviewme.member.dto.response; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import java.time.LocalDateTime; | ||
|
||
@Schema(description = "리뷰 생성 시 필요한 리뷰어 그룹 응답") | ||
public record ReviewCreationReviewerGroupResponse( | ||
|
||
@Schema(description = "리뷰어 그룹 아이디") | ||
long id, | ||
|
||
@Schema(description = "리뷰 그룹 이름 (레포지토리명)") | ||
String name, | ||
|
||
@Schema(description = "그룹 소개") | ||
String description, | ||
|
||
@Schema(description = "리뷰 작성 기한") | ||
LocalDateTime deadline, | ||
|
||
@Schema(description = "썸네일 URL") | ||
String thumbnailUrl, | ||
|
||
@Schema(description = "리뷰이") | ||
MemberResponse reviewee | ||
) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
backend/src/main/java/reviewme/review/dto/response/QuestionResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package reviewme.review.dto.response; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
|
||
@Schema(description = "리뷰 문항 응답") | ||
public record QuestionResponse( | ||
|
||
@Schema(description = "리뷰 문항 ID") | ||
long id, | ||
|
||
@Schema(description = "리뷰 문항") | ||
String content | ||
) { | ||
} |
20 changes: 20 additions & 0 deletions
20
backend/src/main/java/reviewme/review/dto/response/ReviewCreationResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package reviewme.review.dto.response; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import java.util.List; | ||
import reviewme.keyword.dto.response.KeywordResponse; | ||
import reviewme.member.dto.response.ReviewCreationReviewerGroupResponse; | ||
|
||
@Schema(description = "리뷰 생성 시 필요한 정보 응답") | ||
public record ReviewCreationResponse( | ||
|
||
@Schema(description = "리뷰어 그룹") | ||
ReviewCreationReviewerGroupResponse reviewerGroup, | ||
|
||
@Schema(description = "리뷰 문항 목록") | ||
List<QuestionResponse> questions, | ||
|
||
@Schema(description = "키워드 목록") | ||
List<KeywordResponse> keywords | ||
) { | ||
} |
23 changes: 23 additions & 0 deletions
23
backend/src/main/java/reviewme/review/service/QuestionService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package reviewme.review.service; | ||
|
||
import java.util.List; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
import reviewme.review.dto.response.QuestionResponse; | ||
import reviewme.review.repository.QuestionRepository; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class QuestionService { | ||
|
||
private final QuestionRepository questionRepository; | ||
|
||
@Transactional(readOnly = true) | ||
public List<QuestionResponse> findAllQuestions() { | ||
return questionRepository.findAll() | ||
.stream() | ||
.map(question -> new QuestionResponse(question.getId(), question.getContent())) | ||
.toList(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
backend/src/test/java/reviewme/fixture/QuestionFixure.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package reviewme.fixture; | ||
|
||
import reviewme.review.domain.Question; | ||
|
||
public enum QuestionFixure { | ||
|
||
소프트스킬이_어떤가요, | ||
기술역량이_어떤가요, | ||
; | ||
|
||
public Question create() { | ||
return new Question(replaceUnderscores()); | ||
} | ||
|
||
private String replaceUnderscores() { | ||
return name().replace("_", " "); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
backend/src/test/java/reviewme/keyword/service/KeywordServiceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package reviewme.keyword.service; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import java.util.List; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import reviewme.fixture.KeywordFixture; | ||
import reviewme.keyword.dto.response.KeywordResponse; | ||
import reviewme.keyword.repository.KeywordRepository; | ||
import reviewme.support.ServiceTest; | ||
|
||
@ServiceTest | ||
class KeywordServiceTest { | ||
|
||
@Autowired | ||
KeywordService keywordService; | ||
|
||
@Autowired | ||
KeywordRepository keywordRepository; | ||
|
||
@Test | ||
void 모든_키워드를_조회한다() { | ||
// given | ||
keywordRepository.save(KeywordFixture.회의를_이끌어요.create()); | ||
|
||
// when | ||
List<KeywordResponse> keywords = keywordService.findAllKeywords(); | ||
|
||
// then | ||
assertThat(keywords).hasSize(1); | ||
} | ||
} |
Oops, something went wrong.