diff --git a/src/main/java/univ/yesummit/domain/summit/dto/SummitResponseDTO.java b/src/main/java/univ/yesummit/domain/summit/dto/SummitResponseDTO.java index 4439748..2ea4289 100644 --- a/src/main/java/univ/yesummit/domain/summit/dto/SummitResponseDTO.java +++ b/src/main/java/univ/yesummit/domain/summit/dto/SummitResponseDTO.java @@ -2,6 +2,8 @@ public record SummitResponseDTO( + + Long id, String title, String content ) { diff --git a/src/main/java/univ/yesummit/domain/summit/service/impl/SummitServiceImpl.java b/src/main/java/univ/yesummit/domain/summit/service/impl/SummitServiceImpl.java index 738f7b4..e34edfd 100644 --- a/src/main/java/univ/yesummit/domain/summit/service/impl/SummitServiceImpl.java +++ b/src/main/java/univ/yesummit/domain/summit/service/impl/SummitServiceImpl.java @@ -22,7 +22,7 @@ public List getAllSummits() { // 엔티티 리스트를 DTO 리스트로 변환 return summits.stream() - .map(summit -> new SummitResponseDTO(summit.getTitle(), summit.getContent())) + .map(summit -> new SummitResponseDTO(summit.getId(), summit.getTitle(), summit.getContent())) .collect(Collectors.toList()); } @@ -31,6 +31,6 @@ public SummitResponseDTO getSummitById(Long id) { Summit summit = summitRepository.findById(id) .orElseThrow(() -> new IllegalStateException("써밋을 찾을 수 없습니다")); - return new SummitResponseDTO(summit.getTitle(), summit.getContent()); + return new SummitResponseDTO(summit.getId(), summit.getTitle(), summit.getContent()); } }