66import com .back .domain .myhistory .repository .MyHistoryLikedPostRepository ;
77import com .back .domain .post .comment .entity .Comment ;
88import com .back .domain .post .post .entity .Post ;
9+ import com .back .domain .post .post .entity .PostLike ;
910import com .back .domain .post .post .enums .PostStatus ;
11+ import com .back .domain .post .post .enums .PostLikeStatus ;
1012import com .back .global .exception .ServiceException ;
1113import lombok .RequiredArgsConstructor ;
1214import org .springframework .data .domain .PageRequest ;
@@ -127,19 +129,19 @@ public MyHistoryLikedPostListDto getMyLikedPosts(Long userId, LocalDateTime last
127129 int safeLimit = Math .max (1 , Math .min (limit , 100 ));
128130 int fetchSize = safeLimit + 1 ;
129131
130- List <com . back . domain . post . post . entity . PostLike > rows ;
132+ List <PostLike > rows ;
131133 if (lastCreatedAt == null || lastId == null ) {
132134 rows = myHistoryLikedPostRepository .findMyLikedPostsFirstPage (
133135 userId ,
134- com . back . domain . post . post . enums . PostLikeStatus .LIKE ,
135- com . back . domain . post . post . enums . PostStatus .DELETED ,
136+ PostLikeStatus .LIKE ,
137+ PostStatus .DELETED ,
136138 PageRequest .of (0 , fetchSize )
137139 );
138140 } else {
139141 rows = myHistoryLikedPostRepository .findMyLikedPostsAfter (
140142 userId ,
141- com . back . domain . post . post . enums . PostLikeStatus .LIKE ,
142- com . back . domain . post . post . enums . PostStatus .DELETED ,
143+ PostLikeStatus .LIKE ,
144+ PostStatus .DELETED ,
143145 lastCreatedAt ,
144146 lastId ,
145147 PageRequest .of (0 , fetchSize )
@@ -150,12 +152,12 @@ public MyHistoryLikedPostListDto getMyLikedPosts(Long userId, LocalDateTime last
150152 if (hasNext ) rows = rows .subList (0 , safeLimit );
151153
152154 List <MyHistoryLikedPostItemDto > items = new ArrayList <>();
153- for (com . back . domain . post . post . entity . PostLike postLike : rows ) items .add (MyHistoryLikedPostItemDto .from (postLike ));
155+ for (PostLike postLike : rows ) items .add (MyHistoryLikedPostItemDto .from (postLike ));
154156
155157 LocalDateTime nextCreatedAt = null ;
156158 Long nextId = null ;
157159 if (hasNext && !rows .isEmpty ()) {
158- com . back . domain . post . post . entity . PostLike last = rows .get (rows .size () - 1 );
160+ PostLike last = rows .get (rows .size () - 1 );
159161 nextCreatedAt = last .getCreatedAt ();
160162 nextId = last .getId ();
161163 }
@@ -165,10 +167,10 @@ public MyHistoryLikedPostListDto getMyLikedPosts(Long userId, LocalDateTime last
165167
166168 @ Transactional (readOnly = true )
167169 public MyHistoryPostGoResponseDto getPostLinkFromMyLikedPost (Long userId , Long postId ) {
168- com . back . domain . post . post . entity . PostLike postLike = myHistoryLikedPostRepository .findByPostIdAndUserIdLike (
170+ PostLike postLike = myHistoryLikedPostRepository .findByPostIdAndUserIdLike (
169171 postId ,
170172 userId ,
171- com . back . domain . post . post . enums . PostLikeStatus .LIKE
173+ PostLikeStatus .LIKE
172174 );
173175 if (postLike == null ) {
174176 throw new ServiceException (404 , "좋아요한 게시글을 찾을 수 없습니다." );
@@ -180,4 +182,4 @@ public MyHistoryPostGoResponseDto getPostLinkFromMyLikedPost(Long userId, Long p
180182 String apiUrl = "/posts/" + post .getId ();
181183 return new MyHistoryPostGoResponseDto (post .getId (), apiUrl );
182184 }
183- }
185+ }
0 commit comments