Skip to content

Commit

Permalink
Fix: 게시글 상세 조회 api response에 isWriter 추가
Browse files Browse the repository at this point in the history
Fix: 게시글 상세 조회 api response에 isWriter 추가
  • Loading branch information
seoyeonjin authored Jan 23, 2025
2 parents a89529c + 16e1109 commit 9b29d02
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public record PostDetailResponse(
@Schema(description = "수정일", example = "yyyy-mm-dd:hh-mm-ss~")
LocalDateTime updatedAt,
@Schema(description = "좋아요 클릭 여부", example = "true")
boolean isLiked
boolean isLiked,
@Schema(description = "작성자 여부", example = "true")
boolean isWriter
) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@

import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;
import java.util.UUID;

@Service
Expand Down Expand Up @@ -133,6 +134,7 @@ public PostDetailResponse getPostDetail(final Long postId, final Long memberId)
.images(images)
.category(postCategory.getName())
.tags(tags)
.isWriter(Objects.equals(memberId, post.getMemberId()))
.isLiked(postLikeRepository.existsByMemberIdAndPostId(memberId, postId))
.createdAt(post.getCreatedAt())
.updatedAt(post.getUpdatedAt())
Expand Down

0 comments on commit 9b29d02

Please sign in to comment.