Skip to content

Commit

Permalink
Refactor : dashboard API 와 이력서 전체 조회 기능에 ETC 조회 로직 추가
Browse files Browse the repository at this point in the history
- DashBoard API에서도 Etc 데이터를 조회하는 로직을 추가하였습니다.
- 이력서 전체 조회 기능에서도 Etc 데이터를 포함하도록 수정하였습니다.
  • Loading branch information
hyeonda02 committed Dec 10, 2024
1 parent 32de963 commit cf0c1c0
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public class DashBoardServiceImpl implements DashBoardService {
private final EduCareerRepository eduCareerRepository;
private final EmploymentRepository employmentRepository;
private final ProjectRepository projectRepository;
private final CareerEtcRepository etcRepository;

@Override
public DashBoardUserInfoResponse getUserInfo(Member requestMember) {
Expand Down Expand Up @@ -62,7 +63,9 @@ private long getCareerCount(Long memberId) {
competitionRepository.findByMemberId(memberId),
eduCareerRepository.findByMemberId(memberId),
employmentRepository.findByMemberId(memberId),
projectRepository.findByMemberId(memberId)
projectRepository.findByMemberId(memberId),
etcRepository.findByMemberId(memberId)

)
.mapToLong(List::size)
.sum();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import umc.kkijuk.server.common.domian.exception.IntroOwnerMismatchException;
import umc.kkijuk.server.common.domian.exception.RecordNotFoundException;
import umc.kkijuk.server.common.domian.exception.ResourceNotFoundException;
import umc.kkijuk.server.detail.domain.CareerType;
import umc.kkijuk.server.member.domain.Member;
import umc.kkijuk.server.member.repository.MemberRepository;
import umc.kkijuk.server.record.controller.response.*;
Expand Down Expand Up @@ -40,6 +41,8 @@ public class RecordServiceImpl implements RecordService {
private final EduCareerRepository eduCareerRepository;
private final EmploymentRepository employmentRepository;
private final ProjectRepository projectRepository;
private final CareerEtcRepository etcRepository;

private final FileRepository fileRepository;

@Override
Expand Down Expand Up @@ -85,12 +88,16 @@ public RecordResponse getRecord(Long memberId) {
.sorted(Comparator.comparing(EmploymentResponse::getEndDate).reversed())
.toList();

// 활동 및 경험 ( 동아리, 대외활동)
// 활동 및 경험 ( 동아리, 대외활동, 기타 )
List<BaseCareerResponse> activitiesAndExperiences = activityRepository.findByMemberId(memberId).stream()
.map(ActivityResponse::new)
.collect(Collectors.toList());

activitiesAndExperiences.addAll(circleRepository.findByMemberId(memberId).stream()
.map(CircleResponse::new).collect(Collectors.toList()));
activitiesAndExperiences.addAll(etcRepository.findByMemberId(memberId).stream()
.map(EtcResponse::new).collect(Collectors.toList()));

activitiesAndExperiences.stream().sorted(Comparator.comparing(BaseCareerResponse::getEndDate).reversed());

// 프로젝트 ( 프로젝트, 공모전/대회)
Expand Down Expand Up @@ -158,12 +165,15 @@ public RecordResponse updateRecord(Long memberId, Long recordId, RecordReqDto re
.sorted(Comparator.comparing(EmploymentResponse::getEndDate).reversed())
.toList();

//활동 및 경험 ( 동아리, 대외활동)
//활동 및 경험 ( 동아리, 대외활동, 기타 )
List<BaseCareerResponse> activitiesAndExperiences = activityRepository.findByMemberId(memberId).stream()
.map(ActivityResponse::new)
.collect(Collectors.toList());
activitiesAndExperiences.addAll(circleRepository.findByMemberId(memberId).stream()
.map(CircleResponse::new).collect(Collectors.toList()));
activitiesAndExperiences.addAll(etcRepository.findByMemberId(memberId).stream()
.map(EtcResponse::new).collect(Collectors.toList()));

activitiesAndExperiences.stream().sorted(Comparator.comparing(BaseCareerResponse::getEndDate).reversed());

//프로젝트 ( 프로젝트, 공모전/대회)
Expand Down Expand Up @@ -224,33 +234,39 @@ public RecordDownResponse downloadResume(Long recordId, Long memberId) {
Record record = recordRepository.findByMemberId(memberId);

List<ResumeResponse> employments = employmentRepository.findByMemberId(memberId).stream()
.map(employment -> new ResumeResponse(employment.getId(),"경력",employment.getName(),
.map(employment -> new ResumeResponse(employment.getId(),CareerType.EMP.getDescription(),employment.getName(),
employment.getAlias(),employment.getSummary(),employment.getStartdate(),
employment.getEnddate())).collect(Collectors.toList());
//활동 및 경험 ( 대외 활동, 동아리, 기타 )

List<ResumeResponse> activitiesAndExperiences = activityRepository.findByMemberId(memberId).stream()
.map(activity -> new ResumeResponse(activity.getId(), "대외활동",activity.getName(),
.map(activity -> new ResumeResponse(activity.getId(), CareerType.ACTIVITY.getDescription(), activity.getName(),
activity.getAlias(),activity.getSummary(),activity.getStartdate(),
activity.getEnddate())).collect(Collectors.toList());

activitiesAndExperiences.addAll(circleRepository.findByMemberId(memberId).stream()
.map(circle->new ResumeResponse(circle.getId(),"동아리",circle.getName(),
.map(circle->new ResumeResponse(circle.getId(),CareerType.CIRCLE.getDescription(), circle.getName(),
circle.getAlias(),circle.getSummary(),circle.getStartdate(),
circle.getEnddate())).collect(Collectors.toList()));

activitiesAndExperiences.addAll(etcRepository.findByMemberId(memberId).stream()
.map(etc -> new ResumeResponse(etc.getId(), CareerType.ETC.getDescription(), etc.getName(),
etc.getAlias(), etc.getSummary(), etc.getStartdate(),
etc.getEnddate())).collect(Collectors.toList()));

//프로젝트 ( 프로젝트, 공모전/대회)
List<ResumeResponse> projectsAndComp = projectRepository.findByMemberId(memberId).stream()
.map(project->new ResumeResponse(project.getId(),"프로젝트",project.getName(),
.map(project->new ResumeResponse(project.getId(),CareerType.PROJECT.getDescription(), project.getName(),
project.getAlias(),project.getSummary(),project.getStartdate(),
project.getEnddate())).collect(Collectors.toList());

projectsAndComp.addAll(competitionRepository.findByMemberId(memberId).stream()
.map(comp -> new ResumeResponse(comp.getId(),"공모전/대회", comp.getName(),
.map(comp -> new ResumeResponse(comp.getId(),CareerType.COM.getDescription(), comp.getName(),
comp.getAlias(),comp.getSummary(),comp.getStartdate(),
comp.getEnddate())).collect(Collectors.toList()));

List<ResumeResponse> eduCareers = eduCareerRepository.findByMemberId(memberId).stream()
.map(edu-> new ResumeResponse(edu.getId(),"교육",edu.getName(),
.map(edu-> new ResumeResponse(edu.getId(),CareerType.EDU.getDescription(),edu.getName(),
edu.getAlias(),edu.getSummary(),edu.getStartdate(),
edu.getEnddate())).collect(Collectors.toList());

Expand Down

0 comments on commit cf0c1c0

Please sign in to comment.