@@ -81,15 +81,13 @@ public List<CalendarResponseDTO> getCalendarsByUser(UUID userId,
8181 User user = userRepository .findByUserId (userId )
8282 .orElseThrow (() -> new CustomException (ErrorCode .USER_NOT_FOUND ));
8383
84- Group group ;
84+ Group group = null ;
8585 if (groupId != null ){
8686 boolean isMember = isGroupMember (groupId , userId );
8787 CalendarValidator .validateGroupMembership (groupId , isMember );
8888
8989 group = groupRepository .findById (groupId )
9090 .orElseThrow (() -> new CustomException (ErrorCode .GROUP_NOT_FOUND ));
91- } else {
92- throw new CustomException (ErrorCode .GROUP_NOT_FOUND );
9391 }
9492
9593 if (dateTime == null ) {
@@ -142,7 +140,7 @@ public List<CalendarResponseDTO> getCalendarsByUser(UUID userId,
142140 UUID groupID = calendar .getGroup () != null ? calendar .getGroup ().getGroupId () : null ;
143141 String groupName = finalGroupNameMap .get (groupID );
144142
145- return calendarConverter .toDto (calendar , user , group , groupName );
143+ return calendarConverter .toDto (calendar , calendar . getUser (), calendar . getGroup () , groupName );
146144 }).toList ();
147145
148146 } catch (Exception e ) {
@@ -165,7 +163,7 @@ public CalendarResponseDTO getCalendarById(Long calendarId, UUID userId) {
165163 Group calendarGroup = calendar .getGroup ();
166164 String groupName = (calendarGroup != null ) ? calendarGroup .getGroupName () : null ;
167165
168- return calendarConverter .toDto (calendar , user , calendarGroup , groupName );
166+ return calendarConverter .toDto (calendar , calendar . getUser () , calendarGroup , groupName );
169167 }
170168
171169 @ Override
@@ -232,7 +230,7 @@ public CalendarResponseDTO updateCalendar(Long calendarId, UpdateCalendarRequest
232230 Group updatedGroup = updatedCalendar .getGroup ();
233231 String groupName = (updatedGroup != null ) ? updatedGroup .getGroupName () : null ;
234232
235- return calendarConverter .toDto (calendar , user , updatedGroup , groupName );
233+ return calendarConverter .toDto (updatedCalendar , updatedCalendar . getUser () , updatedGroup , groupName );
236234
237235 } catch (Exception e ) {
238236 log .warn ("그룹 일정 수정 중 오류 발생: {}" , e .getMessage ());
@@ -242,7 +240,7 @@ public CalendarResponseDTO updateCalendar(Long calendarId, UpdateCalendarRequest
242240
243241 @ Override
244242 @ Transactional
245- public void deleteCalendar (Long calendarId , LocalDateTime instanceDate , UUID userId ) {
243+ public void deleteCalendar (Long calendarId , UUID userId ) {
246244 try {
247245 Calendar calendar = calendarRepository .findById (calendarId )
248246 .orElseThrow (() -> new CustomException (ErrorCode .CALENDAR_NOT_FOUND ));
@@ -415,10 +413,10 @@ private DateRangeDTO calculateDateRange(String viewType, LocalDateTime baseDate)
415413
416414 case "WEEKLY" -> {
417415 LocalDateTime startOfWeek = baseDate .toLocalDate ()
418- .with (DayOfWeek .MONDAY )
416+ .with (java . time . temporal . TemporalAdjusters . previousOrSame ( DayOfWeek .MONDAY ) )
419417 .atStartOfDay ();
420418 LocalDateTime endOfWeek = baseDate .toLocalDate ()
421- .with (DayOfWeek .SUNDAY )
419+ .with (java . time . temporal . TemporalAdjusters . nextOrSame ( DayOfWeek .SUNDAY ) )
422420 .atTime (23 , 59 , 59 );
423421 yield new DateRangeDTO (startOfWeek , endOfWeek );
424422 }
@@ -427,15 +425,8 @@ private DateRangeDTO calculateDateRange(String viewType, LocalDateTime baseDate)
427425 LocalDate monthStart = baseDate .toLocalDate ().withDayOfMonth (1 );
428426 LocalDate monthEnd = baseDate .toLocalDate ().withDayOfMonth (baseDate .toLocalDate ().lengthOfMonth ());
429427
430- LocalDate calendarStart = monthStart .with (DayOfWeek .SUNDAY );
431- if (calendarStart .isAfter (monthStart )) {
432- calendarStart = calendarStart .minusWeeks (1 );
433- }
434-
435- LocalDate calendarEnd = monthEnd .with (DayOfWeek .SATURDAY );
436- if (calendarEnd .isBefore (monthEnd )) {
437- calendarEnd = calendarEnd .plusWeeks (1 );
438- }
428+ LocalDate calendarStart = monthStart .with (java .time .temporal .TemporalAdjusters .previousOrSame (DayOfWeek .SUNDAY ));
429+ LocalDate calendarEnd = monthEnd .with (java .time .temporal .TemporalAdjusters .nextOrSame (DayOfWeek .SATURDAY ));
439430
440431 yield new DateRangeDTO (
441432 calendarStart .atStartOfDay (),
0 commit comments