Skip to content

Commit

Permalink
fix : add lock filter after bookable span
Browse files Browse the repository at this point in the history
- 프론트에서 bookable span 적용하면서 락이 겹쳐서 보이는 문제 임시 방편으로 해결
- 추후 논의 필요
  • Loading branch information
chanyoung1998 committed Jul 16, 2024
1 parent 7600021 commit 8a428e7
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import java.time.LocalDateTime;
import java.util.List;
import java.util.stream.Collectors;

import static com.dp.dplanner.domain.club.ClubAuthorityType.*;
import static com.dp.dplanner.adapter.dto.LockDto.*;
Expand Down Expand Up @@ -89,7 +90,13 @@ public List<Response> getLocks(Long clubMemberId, Long resourceId, Period period

List<Lock> locks = lockRepository.findBetween(period.getStartDateTime(), period.getEndDateTime(), resourceId);

return Response.ofList(locks);
//todo 임시방편 코드 추후 락 관련 논의 필요
LocalDateTime cutoffDate = LocalDateTime.now().plusDays(resource.getBookableSpan()).toLocalDate().atStartOfDay();
List<Lock> filteredLock = locks.stream()
.filter(lock -> !(lock.getPeriod().getStartDateTime().isAfter(cutoffDate) || lock.getPeriod().getEndDateTime().isAfter(cutoffDate)))
.collect(Collectors.toList());

return Response.ofList(filteredLock);
}


Expand Down

0 comments on commit 8a428e7

Please sign in to comment.