use of wooteco.prolog.report.domain.report.studylog.ReportedStudylog in project prolog by woowacourse.
the class ReportRepositoryTest method createReport.
private Report createReport(Member member) {
Ability ability1 = abilityRepository.save(AbilityFixture.parentAbility1(member));
Ability ability2 = abilityRepository.save(AbilityFixture.parentAbility2(member));
Ability ability3 = abilityRepository.save(AbilityFixture.parentAbility3(member));
GraphAbilities graphAbilities = new GraphAbilities(Arrays.asList(new GraphAbility(ability1, 1L, true), new GraphAbility(ability2, 2L, true), new GraphAbility(ability3, 3L, true)));
Level level1 = levelRepository.save(LevelFixture.level1());
Mission mission = missionRepository.save(MissionFixture.mission1(level1));
Ability ability4 = abilityRepository.save(AbilityFixture.childAbility1(member, ability1));
Ability ability5 = abilityRepository.save(AbilityFixture.childAbility2(member, ability2));
Studylog studylog = studylogRepository.save(createStudylog(member, mission));
ReportedStudylogs reportedStudylogs = new ReportedStudylogs(Arrays.asList(new ReportedStudylog(studylog.getId(), Arrays.asList(new ReportedStudylogAbility(ability4), new ReportedStudylogAbility(ability5))), new ReportedStudylog(studylog.getId(), Arrays.asList(new ReportedStudylogAbility(ability4), new ReportedStudylogAbility(ability5)))));
return ReportFixture.builder().member(member).title("test report").description("test report").graph(new AbilityGraph(graphAbilities)).member(member).studylogs(reportedStudylogs).build();
}
use of wooteco.prolog.report.domain.report.studylog.ReportedStudylog in project prolog by woowacourse.
the class ReportAssembler method of.
private StudylogResponse of(ReportedStudylog reportedStudylog) {
List<StudylogAbilityResponse> abilityResponses = reportedStudylog.getAbilities().stream().map(this::of).collect(toList());
Studylog studylog = studylogRepository.findById(reportedStudylog.getStudylogId()).orElseThrow(StudylogNotFoundException::new);
return new StudylogResponse(studylog.getId(), studylog.getCreatedAt(), studylog.getUpdatedAt(), studylog.getTitle(), abilityResponses);
}
Aggregations