@@ -77,8 +77,8 @@ public ArchiveResponseDto createArchive(ArchiveCreateRequestDto requestDto) {
7777
7878 // 조회
7979 @ Transactional (readOnly = true )
80- public ArchiveResponseDto getArchive (Long id , ArchiveType archiveType ) {
81- Archive archive = findArchiveByType ( id , archiveType );
80+ public ArchiveResponseDto getArchive (Long archiveId ) {
81+ Archive archive = getArchiveById ( archiveId );
8282 UserBook userBook = getUserBookFromExcerptOrReview (archive );
8383 // currentUser와 creatorUser 사이의 관계에 따른 response 필터링
8484 Long currentUserId = userService .getCurrentUser ().getUserId ();
@@ -118,8 +118,8 @@ public ArchiveResponseDto getSharedArchive(Long id, ArchiveType archiveType) {
118118 }
119119
120120 // 수정
121- public ArchiveResponseDto updateArchive (Long id , ArchiveType archiveType , ArchiveUpdateRequestDto requestDto ) {
122- Archive archive = findArchiveByType ( id , archiveType );
121+ public ArchiveResponseDto updateArchive (Long archiveId , ArchiveUpdateRequestDto requestDto ) {
122+ Archive archive = getArchiveById ( archiveId );
123123 UserBook userBook = getUserBookFromExcerptOrReview (archive );
124124 // 생성자 검증
125125 userBookService .validateUserBookOwner (userBook );
@@ -210,9 +210,10 @@ public UserArchiveResponseDto getUserArchive(Long userId, ArchiveType archiveTyp
210210 if (!userId .equals (currentUserId ) && excerpt .getVisibility () != Visibility .PUBLIC ) {
211211 continue ;
212212 }
213+ Long archiveId = findArchiveByType (excerpt .getExcerptId (), EXCERPT ).getArchiveId ();
213214 String title = excerpt .getUserBook ().getBookInfo ().getTitle ();
214215 String author = excerpt .getUserBook ().getBookInfo ().getAuthor ();
215- archiveList .add (new UserArchiveResponseDto .ArchiveWithType (EXCERPT , ExcerptResponseDto .from (excerpt ), title , author ));
216+ archiveList .add (new UserArchiveResponseDto .ArchiveWithType (EXCERPT , ExcerptResponseDto .from (excerpt ), archiveId , title , author ));
216217 }
217218 }
218219 // 리뷰 조회
@@ -222,9 +223,10 @@ public UserArchiveResponseDto getUserArchive(Long userId, ArchiveType archiveTyp
222223 if (!userId .equals (currentUserId ) && review .getVisibility () != Visibility .PUBLIC ) {
223224 continue ;
224225 }
226+ Long archiveId = findArchiveByType (review .getReviewId (), REVIEW ).getArchiveId ();
225227 String title = review .getUserBook ().getBookInfo ().getTitle ();
226228 String author = review .getUserBook ().getBookInfo ().getAuthor ();
227- archiveList .add (new UserArchiveResponseDto .ArchiveWithType (REVIEW , ReviewResponseDto .from (review ), title , author ));
229+ archiveList .add (new UserArchiveResponseDto .ArchiveWithType (REVIEW , ReviewResponseDto .from (review ), archiveId , title , author ));
228230 }
229231 }
230232 // 데이터 합친 후 최신순 정렬
0 commit comments