Skip to content

Commit 36eb6da

Browse files
authored
Merge pull request #23 from Neighbors-dev/develop
[FEAT] 편지 상세보기 DTO 정보 추가
2 parents 17dfed6 + 4a53add commit 36eb6da

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

src/main/java/com/neighbors/tohero/application/letter/dto/GetLetterDetailResponse.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ public record LetterInfo(
99
long letterId,
1010
String content,
1111
String from,
12-
String to
12+
String to,
13+
boolean isOpened,
14+
boolean isPublic
1315
){}
1416

1517
public static GetLetterDetailResponse from(Letter letter) {
16-
return new GetLetterDetailResponse(new LetterInfo(letter.getLetterId(), letter.getLetterContent(), letter.getWriter(), letter.getTargetName()));
18+
return new GetLetterDetailResponse(new LetterInfo(letter.getLetterId(), letter.getLetterContent(), letter.getWriter(), letter.getTargetName(), letter.isOpened(), letter.isPublic()));
1719
}
1820
}

src/main/java/com/neighbors/tohero/domain/domain/mainPage/service/GetLetter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public List<Letter> getPageableLetter(Pageable pageable){
2323
}
2424

2525
public Letter getLetterById(long letterId){
26-
return letterRepository.getLetter(repo -> repo.findByIdAndPublic(letterId));
26+
return letterRepository.getLetter(repo -> repo.findById(letterId));
2727
}
2828

2929
public List<Letter> getMyLetters(long userId){

src/main/java/com/neighbors/tohero/infrastructure/repository/LetterEntityRepository.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ public interface LetterEntityRepository extends JpaRepository<LetterEntity, Long
2424
@Query("SELECT le FROM LetterEntity le WHERE le.user.userId = :userId")
2525
Optional<List<LetterEntity>> findAllByUserId(@Param("userId") Long userId);
2626

27-
@Query("SELECT le FROM LetterEntity le WHERE le.letterId = :letterId AND le.isPublic = true")
28-
Optional<LetterEntity> findByIdAndPublic(@Param("letterId") long letterId);
27+
@Query("SELECT le FROM LetterEntity le WHERE le.letterId = :letterId")
28+
Optional<LetterEntity> findById(@Param("letterId") long letterId);
2929

3030
@Modifying
3131
@Query("UPDATE LetterEntity le SET le.isPublic = :isPublic WHERE le.user.userId = :userId AND le.letterId = :letterId")

0 commit comments

Comments
 (0)