-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEAT] 지난 & 다가올 데이트 일정 전체 조회 API 구현 - #38 #67
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
우왕 완전 수고하셨습니다!!! 짱! 👍 💯 😍
@@ -37,6 +42,15 @@ public void createDate(final Long userId, final DateCreateReq dateCreateReq) { | |||
createDatePlace(date, dateCreateReq.places()); | |||
} | |||
|
|||
public DatesGetRes getDates(Long userId, String time) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
final 붙여주시면 감사합니다..!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
헉 감사합니다 ㅎㅎ
} | ||
|
||
private int calculateDday(LocalDate date, LocalDate currentDate) { | ||
return (int) ChronoUnit.DAYS.between(currentDate, date); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ChronoUnit 이건 날짜 차이를 int형으로 반환하는 건가요? (잘 몰라서 그렇습니다!)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
우왕 완전 수고하셨습니다!!! 짱! 👍 💯 😍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
long 타입으로 반환해줘서 int 형으로 타입변환했습니다!
LocalDate currentDate = LocalDate.now(); | ||
List<Date> dates = fetchDatesByUserIdAndTime(userId, time, currentDate); | ||
List<DateGetRes> dateGetResList = dates.stream() | ||
.map(date -> createDateGetRes(date, currentDate)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
다가올 일정 인지 지난 데이트인지 상관없이 createDateGetRes를 통해서 d-day를 계산하는것 같습니다!
지난 일정에는 굳이 계산하는 로직이 필요 없을 것 같습니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오 좋은 거 같습니다..! 지난 일정일 경우 -1이나 0과 같은 고정값으로 반환해도 좋을 것 같아요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
: 굿 짱 굿 짱! 우리 리드 최고다!
🔥Pull requests
⛳️ 작업한 브랜치
👷 작업한 내용
지난 & 다가올 데이트 일정 전체 조회 API를 구현했습니다.
@RequestParam의 String name으로 PAST/FUTURE을 받아 PAST일 경우 유저의 지난 일정을 전체 조회해주며, FUTURE일 경우 유저의 지나지 않은 일정을 전체 조회해줍니다.
API 재사용을 위해 각각의 상황을 @RequestParam로 받아 구현하게 됐습니다.
Jpa QueryDSL을 통해 각각의 필터에 해당하는 Date를 리스트로 받아오며, DateGetRes를 List로 받은 DatesGetRes를 응답으로 받습니다.
추가로 ChronoUnit.DAYS.between를 사용해서 두 날짜의 시간 차를 구해서 디데이를 반환해줬습니다.
🚨 참고 사항
📟 관련 이슈