Skip to content

Commit ff6eedf

Browse files
committed
fix: 필드 수정
1 parent 26e76e4 commit ff6eedf

File tree

2 files changed

+3
-18
lines changed

2 files changed

+3
-18
lines changed

src/main/java/org/ahpuh/surf/post/repository/PostRepositoryImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public List<FollowingPostDto> findFollowingPosts(final Long userId, final Pageab
3333
post.imageUrl.as("imageUrl"),
3434
post.fileUrl.as("fileUrl"),
3535
post.selectedDate,
36-
post.updatedAt.as("updatedAt")
36+
post.createdAt.as("createdAt")
3737
))
3838
.from(post)
3939
.leftJoin(follow).on(follow.user.userId.eq(userId))
@@ -59,7 +59,7 @@ public List<FollowingPostDto> findNextFollowingPosts(final Long userId, final Lo
5959
post.imageUrl.as("imageUrl"),
6060
post.fileUrl.as("fileUrl"),
6161
post.selectedDate,
62-
post.updatedAt.as("updatedAt")
62+
post.createdAt.as("createdAt")
6363
))
6464
.from(post)
6565
.leftJoin(follow).on(follow.user.userId.eq(userId))

src/test/java/org/ahpuh/surf/post/repository/PostRepositoryTest.java

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import org.junit.jupiter.api.Test;
1818
import org.springframework.beans.factory.annotation.Autowired;
1919
import org.springframework.boot.test.context.SpringBootTest;
20-
import org.springframework.data.domain.PageRequest;
2120
import org.springframework.transaction.annotation.Transactional;
2221

2322
import javax.persistence.EntityManager;
@@ -139,7 +138,6 @@ void setUp() {
139138
@Test
140139
@Transactional
141140
void testQueryDsl() {
142-
// Querydsl test
143141
final JPAQueryFactory query = new JPAQueryFactory(entityManager);
144142
final List<FollowingPostDto> posts = query
145143
.select(new QFollowingPostDto(
@@ -154,7 +152,7 @@ void testQueryDsl() {
154152
post.imageUrl.as("imageUrl"),
155153
post.fileUrl.as("fileUrl"),
156154
post.selectedDate,
157-
post.updatedAt.as("updatedAt")
155+
post.createdAt.as("createdAt")
158156
))
159157
.from(post)
160158
.leftJoin(follow).on(follow.user.userId.eq(userId1))
@@ -172,19 +170,6 @@ void testQueryDsl() {
172170
() -> assertThat(posts.get(2).getContent(), is("content1")),
173171
() -> assertThat(posts.get(2).getUserId(), is(userId2))
174172
);
175-
176-
// JpaRepository에 Querydsl 적용 test
177-
final List<FollowingPostDto> findByJpaRepo = postRepository.findFollowingPosts(userId1, PageRequest.of(0, 10));
178-
179-
assertAll("follow한 사용자의 모든 posts in repository",
180-
() -> assertThat(findByJpaRepo.size(), is(3)),
181-
() -> assertThat(findByJpaRepo.get(0).getContent(), is("content3")),
182-
() -> assertThat(findByJpaRepo.get(0).getUserId(), is(userId2)),
183-
() -> assertThat(findByJpaRepo.get(1).getContent(), is("content2")),
184-
() -> assertThat(findByJpaRepo.get(1).getUserId(), is(userId3)),
185-
() -> assertThat(findByJpaRepo.get(2).getContent(), is("content1")),
186-
() -> assertThat(findByJpaRepo.get(2).getUserId(), is(userId2))
187-
);
188173
}
189174

190175
}

0 commit comments

Comments
 (0)