Skip to content

Commit

Permalink
RAC-341 fix : 멘토링 완료건 조회시 완료일순 정렬
Browse files Browse the repository at this point in the history
  • Loading branch information
ywj9811 committed Apr 17, 2024
1 parent 667a9a6 commit 72e92c9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.util.List;

import static com.postgraduate.domain.mentoring.application.mapper.MentoringMapper.*;
import static com.postgraduate.domain.mentoring.util.DateUtils.stringToLocalDateTime;
import static java.time.Duration.between;

@Service
Expand Down Expand Up @@ -70,6 +71,12 @@ public DoneSeniorMentoringResponse getSeniorDone(User user) {
List<Mentoring> mentorings = mentoringGetService.bySeniorDone(senior);
List<DoneSeniorMentoringInfo> doneSeniorMentoringInfos = mentorings.stream()
.map(MentoringMapper::mapToSeniorDoneInfo)
.sorted((o1, o2) -> {
if (stringToLocalDateTime(o1.date())
.isAfter(stringToLocalDateTime(o2.date())))
return -1;
return 1;
})
.toList();
return new DoneSeniorMentoringResponse(doneSeniorMentoringInfos);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
import com.postgraduate.domain.mentoring.application.dto.DoneMentoringInfo;
import com.postgraduate.domain.mentoring.application.dto.ExpectedMentoringInfo;
import com.postgraduate.domain.mentoring.application.dto.WaitingMentoringInfo;
import com.postgraduate.domain.mentoring.application.dto.res.*;
import com.postgraduate.domain.mentoring.application.dto.res.AppliedMentoringDetailResponse;
import com.postgraduate.domain.mentoring.application.dto.res.DoneMentoringResponse;
import com.postgraduate.domain.mentoring.application.dto.res.ExpectedMentoringResponse;
import com.postgraduate.domain.mentoring.application.dto.res.WaitingMentoringResponse;
import com.postgraduate.domain.mentoring.application.mapper.MentoringMapper;
import com.postgraduate.domain.mentoring.domain.entity.Mentoring;
import com.postgraduate.domain.mentoring.domain.service.MentoringGetService;
Expand All @@ -15,6 +18,7 @@
import java.util.List;

import static com.postgraduate.domain.mentoring.application.mapper.MentoringMapper.mapToAppliedDetailInfo;
import static com.postgraduate.domain.mentoring.util.DateUtils.stringToLocalDateTime;

@Service
@Transactional(readOnly = true)
Expand Down Expand Up @@ -47,6 +51,12 @@ public DoneMentoringResponse getDone(User user) {
List<Mentoring> mentorings = mentoringGetService.byUserDone(user);
List<DoneMentoringInfo> doneMentoringInfos = mentorings.stream()
.map(MentoringMapper::mapToDoneInfo)
.sorted((o1, o2) -> {
if (stringToLocalDateTime(o1.date())
.isAfter(stringToLocalDateTime(o2.date())))
return -1;
return 1;
})
.toList();
return new DoneMentoringResponse(doneMentoringInfos);
}
Expand Down

0 comments on commit 72e92c9

Please sign in to comment.