Skip to content

Commit

Permalink
Merge pull request #39 from 9oormthon-univ/dev
Browse files Browse the repository at this point in the history
[#36]✨Feat: 응답 객체에 써밋ID 추가
  • Loading branch information
sumin220 authored Nov 23, 2024
2 parents 8aa4c8b + 6548e88 commit 4faaf0a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@


public record SummitResponseDTO(

Long id,
String title,
String content
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public List<SummitResponseDTO> 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());
}

Expand All @@ -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());
}
}

0 comments on commit 4faaf0a

Please sign in to comment.