Skip to content

Commit e806608

Browse files
committed
feat: 게시글 리스트 조회 해결
1 parent 065ddd5 commit e806608

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/post/dto/all-posts.response.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ export class PostDto extends GetAllPostDto {
2828
this.content = post.content;
2929
this.createdAt = dayjs(post.createdAt).format('YYYY-MM-DDTHH:mm:ssZ');
3030
this.postImages = post.postImages ?? [];
31-
this.isPostLike =
32-
post.postLikesUserIds?.some((like) => like === currentUserId) || false;
31+
this.isPostLike = post.postLikes.length > 0 ? true : false;
3332
this.requestStatus = requestStatus;
3433
this.user = new UserDto(post.user);
3534
}

src/post/dto/dto/get-all-posts.dto.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@ export class GetAllPostDto extends PickType(Post, ['id', 'content']) {
5151
description: '좋아요 IDs',
5252
example: [1, 2, 3],
5353
})
54-
postLikesUserIds: number[]; // 좋아요 목록
54+
postLikes: number[]; // 좋아요 목록
5555
}

src/post/post.service.ts

+1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ export class PostService {
9090
.skip((pageOptionsDto.page - 1) * pageOptionsDto.take);
9191

9292
const posts = await queryBuilder.getMany();
93+
console.log(posts);
9394

9495
const total = await queryBuilder.getCount();
9596

0 commit comments

Comments
 (0)