Search in sources :

Example 1 with AbilityStudylogResponse

use of wooteco.prolog.ability.application.dto.AbilityStudylogResponse in project prolog by woowacourse.

the class StudylogAbilityService method findAbilityStudylogsMappingOnlyByAbilityIds.

public PageableResponse<AbilityStudylogResponse> findAbilityStudylogsMappingOnlyByAbilityIds(String username, List<Long> abilityIds, Pageable pageable) {
    if (abilityIds != null && !abilityIds.isEmpty()) {
        Page<StudylogAbility> studylogAbilities = studylogAbilityRepository.findByAbilityIdIn(abilityIds, pageable);
        List<AbilityStudylogResponse> abilityStudylogResponses = AbilityStudylogResponse.listOf(studylogAbilities.getContent());
        return PageableResponse.of(abilityStudylogResponses, studylogAbilities);
    }
    Member member = memberService.findByUsername(username);
    Page<StudylogAbility> studylogAbilities = studylogAbilityRepository.findByMemberId(member.getId(), pageable);
    List<AbilityStudylogResponse> abilityStudylogResponses = AbilityStudylogResponse.listOf(studylogAbilities.getContent());
    return PageableResponse.of(abilityStudylogResponses, studylogAbilities);
}
Also used : StudylogAbility(wooteco.prolog.ability.domain.StudylogAbility) AbilityStudylogResponse(wooteco.prolog.ability.application.dto.AbilityStudylogResponse) Member(wooteco.prolog.member.domain.Member)

Aggregations

AbilityStudylogResponse (wooteco.prolog.ability.application.dto.AbilityStudylogResponse)1 StudylogAbility (wooteco.prolog.ability.domain.StudylogAbility)1 Member (wooteco.prolog.member.domain.Member)1