Skip to content

Commit

Permalink
Merge pull request #65 from studio-recoding/!HOTFIX-schedule-return
Browse files Browse the repository at this point in the history
[⚠️!HOTFIX] 하루 치 스케쥴 반환 문제 해결
  • Loading branch information
JeonHaeseung authored May 9, 2024
2 parents bd5faf7 + 7a006a8 commit c50ae50
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,10 @@ List<Schedule> findOneMonthSchedulesByMember_Id(
@Param("year") int year,
@Param("month") int month);

// 특정 맴버의 하루 치 스케쥴 반환(String 사용)
@Query( value = "SELECT * FROM schedule " +
"WHERE member_id = :memberId " +
"AND YEAR(start_time) = :year " +
"AND MONTH(start_time) = :month " +
"AND DAY(start_time) = :day " +
"ORDER BY start_time ASC",
nativeQuery = true)
List<Schedule> findOneDaySchedulesByMember_IdWithString(
@Param("memberId") Long memberId,
@Param("year") int year,
@Param("month") int month,
@Param("day") int day);

// 특정 맴버의 하루 치 스케쥴 반환(ZoneDateTime 사용)
@Query( value = "SELECT * FROM schedule " +
"WHERE member_id = :memberId " +
"AND DATE(start_time) = DATE(:date) " +
"AND DATE(CONVERT_TZ(start_time, '+00:00', '+09:00')) = DATE(CONVERT_TZ(:date, '+00:00', '+09:00')) " +
"ORDER BY start_time ASC",
nativeQuery = true)
List<Schedule> findOneDaySchedulesByMember_Id(
Expand Down
12 changes: 1 addition & 11 deletions src/main/java/Ness/Backend/domain/schedule/ScheduleService.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,6 @@ public GetScheduleListDto getOneDayUserSchedule(Long memberId, ZonedDateTime dat

/* 사용자가 직접 변경한 스케쥴 RDB에 저장하는 로직 */
public GetScheduleListDto changeSchedule(Long memberId, PutScheduleDto putScheduleDto, String date){
// 년도, 월, 일 추출
/*
String[] parts = date.split("-");
int year = Integer.parseInt(parts[0]);
int month = Integer.parseInt(parts[1]);
int day = Integer.parseInt(parts[2]);
*/

Schedule schedule = scheduleRepository.findScheduleById(putScheduleDto.getId());
Category category = categoryRepository.findCategoryById(putScheduleDto.getCategoryNum());
schedule.changeSchedule(
Expand All @@ -83,9 +75,7 @@ public GetScheduleListDto changeSchedule(Long memberId, PutScheduleDto putSchedu
putScheduleDto.getEndTime(),
category);

return makeScheduleListDto(
scheduleRepository
.findOneDaySchedulesByMember_Id(memberId, schedule.getStartTime().withZoneSameInstant(ZoneId.of("Asia/Seoul"))));
return getOneDayUserSchedule(memberId, schedule.getStartTime().withZoneSameInstant(ZoneId.of("Asia/Seoul")));
}

/* 사용자가 직접 삭제한 스케쥴 */
Expand Down

0 comments on commit c50ae50

Please sign in to comment.