-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6371c1a
commit b13e82a
Showing
8 changed files
with
193 additions
and
0 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
...re/src/main/java/org/nexters/jaknaesocore/domain/survey/dto/OnboardingSurveyResponse.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,5 @@ | ||
package org.nexters.jaknaesocore.domain.survey.dto; | ||
|
||
import java.util.List; | ||
|
||
public record OnboardingSurveyResponse(List<SurveyResponse> surveyResponses) {} |
21 changes: 21 additions & 0 deletions
21
...eso-core/src/main/java/org/nexters/jaknaesocore/domain/survey/model/OnboardingSurvey.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,21 @@ | ||
package org.nexters.jaknaesocore.domain.survey.model; | ||
|
||
import jakarta.persistence.DiscriminatorValue; | ||
import jakarta.persistence.Entity; | ||
import lombok.AccessLevel; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@DiscriminatorValue("ONBOARDING") | ||
public class OnboardingSurvey extends Survey { | ||
|
||
public OnboardingSurvey(final String content, final SurveyBundle surveyBundle) { | ||
super(content, surveyBundle); | ||
} | ||
|
||
@Override | ||
public SurveyType getSurveyType() { | ||
return SurveyType.ONBOARDING; | ||
} | ||
} |
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 |
---|---|---|
|
@@ -3,5 +3,6 @@ | |
public enum SurveyType { | ||
MULTIPLE_CHOICE, | ||
BALANCE, | ||
ONBOARDING, | ||
; | ||
} |
6 changes: 6 additions & 0 deletions
6
...in/java/org/nexters/jaknaesocore/domain/survey/repository/OnboardingSurveyRepository.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,6 @@ | ||
package org.nexters.jaknaesocore.domain.survey.repository; | ||
|
||
import org.nexters.jaknaesocore.domain.survey.model.OnboardingSurvey; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface OnboardingSurveyRepository extends JpaRepository<OnboardingSurvey, Long> {} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -571,4 +571,64 @@ void throwSurveyNotFoundException() { | |
tuple("나의 행복 지수는", "3점", null, "2025.01.03"), | ||
tuple("나는 노는게 좋다.", "4점", "당연히 노는게 좋은거 아닌가?", "2025.02.01")); | ||
} | ||
|
||
@Test | ||
void 온보딩_설문_목록을_가져온다() { | ||
// given | ||
Member member = Member.create("나민혁", "[email protected]"); | ||
memberRepository.save(member); | ||
SurveyBundle surveyBundle = new SurveyBundle(); | ||
|
||
surveyBundleRepository.save(surveyBundle); | ||
|
||
OnboardingSurvey survey1 = | ||
new OnboardingSurvey( | ||
"새로운 아이디어를 갖고 창의적인 것이 그/그녀에게 중요하다. 그/그녀는 일을 자신만의 독특한 방식으로 하는 것을 좋아한다.", surveyBundle); | ||
OnboardingSurvey survey2 = | ||
new OnboardingSurvey("그/그녀에게 부자가 되는 것은 중요하다. 많은 돈과 비싼 물건들을 가지길 원한다.", surveyBundle); | ||
OnboardingSurvey survey3 = | ||
new OnboardingSurvey( | ||
"세상의 모든 사람들이 평등하게 대우받아야 한다고 생각한다. 그/그녀는 모든 사람이 인생에서 동등한 기회를 가져야 한다고 믿는다.", | ||
surveyBundle); | ||
OnboardingSurvey survey4 = | ||
new OnboardingSurvey( | ||
"그/그녀에게 자신의 능력을 보여주는 것이 매우 중요하다. 사람들이 자신이 하는 일을 인정해주길 바란다.", surveyBundle); | ||
|
||
surveyRepository.saveAll(List.of(survey1, survey2, survey3, survey4)); | ||
|
||
List<KeywordScore> scores = | ||
List.of( | ||
KeywordScore.builder().keyword(Keyword.ADVENTURE).score(BigDecimal.ONE).build(), | ||
KeywordScore.builder().keyword(Keyword.BENEVOLENCE).score(BigDecimal.TWO).build()); | ||
|
||
SurveyOption option1 = | ||
SurveyOption.builder().survey(survey1).scores(scores).content("전혀 나와 같지않다.").build(); | ||
SurveyOption option2 = | ||
SurveyOption.builder().survey(survey2).scores(scores).content("나와 같지 않다.").build(); | ||
SurveyOption option3 = | ||
SurveyOption.builder().survey(survey3).scores(scores).content("나와 조금 같다.").build(); | ||
SurveyOption option4 = | ||
SurveyOption.builder().survey(survey4).scores(scores).content("나와 같다.").build(); | ||
|
||
surveyOptionRepository.saveAll(List.of(option1, option2, option3, option4)); | ||
// when | ||
OnboardingSurveyResponse response = surveyService.getOnboardingSurveys(); | ||
// then | ||
then(response.surveyResponses()) | ||
.extracting("id", "contents", "surveyType") | ||
.containsExactly( | ||
tuple( | ||
survey1.getId(), | ||
"새로운 아이디어를 갖고 창의적인 것이 그/그녀에게 중요하다. 그/그녀는 일을 자신만의 독특한 방식으로 하는 것을 좋아한다.", | ||
"ONBOARDING"), | ||
tuple(survey2.getId(), "그/그녀에게 부자가 되는 것은 중요하다. 많은 돈과 비싼 물건들을 가지길 원한다.", "ONBOARDING"), | ||
tuple( | ||
survey3.getId(), | ||
"세상의 모든 사람들이 평등하게 대우받아야 한다고 생각한다. 그/그녀는 모든 사람이 인생에서 동등한 기회를 가져야 한다고 믿는다.", | ||
"ONBOARDING"), | ||
tuple( | ||
survey4.getId(), | ||
"그/그녀에게 자신의 능력을 보여주는 것이 매우 중요하다. 사람들이 자신이 하는 일을 인정해주길 바란다.", | ||
"ONBOARDING")); | ||
} | ||
} |
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