Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ public class Card {
@OneToMany(mappedBy = "card", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
private List<Cardlink> cardlinks;

private byte[] createdBy; // 사용자 ID 저장 필드 (x-auth-sub와 매칭됨)

}

Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,17 @@ public List<LatestActivityResponse> getActivitiesByDateRangeGroupedBySpace(Local

//사용자가 생성한 카드만 필터링
List<Card> userCards = cards.stream()
.filter(card -> Arrays.equals(uuidHelper.convertUUIDToByteArray(userId), card.getCreatedBy())) // `createdBy`는 Card 엔티티에 있어야 합니다.
.filter(card -> {
byte[] spaceId = card.getSpaceId();
Space space = spaceRepository.findById(spaceId).orElse(null);
return space != null && Arrays.equals(uuidHelper.convertUUIDToByteArray(userId), space.getUserId());
})
.toList();

if (userCards.isEmpty()) {
throw new ResponseStatusException(HttpStatus.NOT_FOUND, "No activity found for this user today.");
}

if (cards.isEmpty()) {
throw new ResponseStatusException(HttpStatus.NOT_FOUND, "No activity found for selected date range.");
}
Expand Down
Loading