Skip to content

Commit 005ac76

Browse files
Dante0922claude
andauthored
#51 [Refactor] User 엔티티 연결 및 전 도메인 TODO 해소 (#66)
## Summary - Vote, Perspective, PerspectiveComment, PerspectiveLike, CreditHistory의 `Long userId` → `@ManyToOne User` 엔티티 관계로 전환 - Perspective의 `Long battleId`, `Long optionId` → `@ManyToOne Battle`, `@ManyToOne BattleOption`으로 전환 - 전 도메인 컨트롤러의 `Long userId = 1L` 하드코딩 → `@AuthenticationPrincipal Long userId`로 교체 (VoteController, PerspectiveController, PerspectiveCommentController, PerspectiveLikeController) - 해소된 TODO 주석 제거 (S3 임시 구현 3건, AdMob 포인트 합산, Prevote 체크) - #64 작업 포함: S3 Presigned URL, 홈 API 섹션별 DTO, 철학자 유형 산출/확장, 탐색 탭 검색 API ## Changes (29 files) - **Entities** (5): Vote, Perspective, PerspectiveComment, PerspectiveLike, CreditHistory - **Repositories** (5): VoteRepository, PerspectiveRepository, PerspectiveCommentRepository, PerspectiveLikeRepository, CreditHistoryRepository - **Services** (10): VoteServiceImpl, VoteQueryService, PerspectiveService, PerspectiveCommentService, PerspectiveLikeService, PerspectiveQueryService, CreditService, MypageService, ScenarioServiceImpl, BattleServiceImpl - **Controllers** (5): VoteController, PerspectiveController, PerspectiveCommentController, PerspectiveLikeController, ScenarioController - **Infra** (3): S3Config, S3PresignedUrlService, FileUploadResponse — TODO 제거 - **Tests** (2): CreditServiceTest, MypageServiceTest ## Test plan - [x] `./gradlew compileJava compileTestJava` 컴파일 성공 - [x] CreditServiceTest 5개 통과 - [x] MypageServiceTest 12개 통과 - [ ] 로컬 Swagger에서 @AuthenticationPrincipal 동작 확인 - [ ] 투표 → 관점 → 좋아요/댓글 플로우 E2E 확인 Closes #51 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent b7f9fe7 commit 005ac76

29 files changed

Lines changed: 192 additions & 172 deletions

src/main/java/com/swyp/app/domain/battle/service/BattleServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public BattleUserDetailResponse getBattleDetail(Long battleId) {
137137
List<Tag> allTags = getTagsByBattle(battle);
138138
List<BattleOption> options = battleOptionRepository.findByBattle(battle);
139139

140-
String voteStatus = voteRepository.findByBattleAndUserId(battle, 1L)
140+
String voteStatus = voteRepository.findByBattleIdAndUserId(battleId, 1L)
141141
.map(v -> v.getPostVoteOption() != null ? v.getPostVoteOption().getLabel().name() : "NONE")
142142
.orElse("NONE");
143143

src/main/java/com/swyp/app/domain/perspective/controller/PerspectiveCommentController.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import io.swagger.v3.oas.annotations.tags.Tag;
1212
import jakarta.validation.Valid;
1313
import lombok.RequiredArgsConstructor;
14+
import org.springframework.security.core.annotation.AuthenticationPrincipal;
1415
import org.springframework.web.bind.annotation.DeleteMapping;
1516
import org.springframework.web.bind.annotation.GetMapping;
1617
import org.springframework.web.bind.annotation.PatchMapping;
@@ -33,33 +34,30 @@ public class PerspectiveCommentController {
3334
@PostMapping("/perspectives/{perspectiveId}/comments")
3435
public ApiResponse<CreateCommentResponse> createComment(
3536
@PathVariable Long perspectiveId,
37+
@AuthenticationPrincipal Long userId,
3638
@RequestBody @Valid CreateCommentRequest request
3739
) {
38-
// TODO: Security 적용 후 @AuthenticationPrincipal로 userId 교체
39-
Long userId = 1L;
4040
return ApiResponse.onSuccess(commentService.createComment(perspectiveId, userId, request));
4141
}
4242

4343
@Operation(summary = "댓글 목록 조회", description = "특정 관점의 댓글 목록을 커서 기반 페이지네이션으로 조회합니다.")
4444
@GetMapping("/perspectives/{perspectiveId}/comments")
4545
public ApiResponse<CommentListResponse> getComments(
4646
@PathVariable Long perspectiveId,
47+
@AuthenticationPrincipal Long userId,
4748
@RequestParam(required = false) String cursor,
4849
@RequestParam(required = false) Integer size
4950
) {
50-
// TODO: Security 적용 후 @AuthenticationPrincipal로 userId 교체
51-
Long userId = 1L;
5251
return ApiResponse.onSuccess(commentService.getComments(perspectiveId, userId, cursor, size));
5352
}
5453

5554
@Operation(summary = "댓글 삭제", description = "본인이 작성한 댓글을 삭제합니다.")
5655
@DeleteMapping("/perspectives/{perspectiveId}/comments/{commentId}")
5756
public ApiResponse<Void> deleteComment(
5857
@PathVariable Long perspectiveId,
59-
@PathVariable Long commentId
58+
@PathVariable Long commentId,
59+
@AuthenticationPrincipal Long userId
6060
) {
61-
// TODO: Security 적용 후 @AuthenticationPrincipal로 userId 교체
62-
Long userId = 1L;
6361
commentService.deleteComment(perspectiveId, commentId, userId);
6462
return ApiResponse.onSuccess(null);
6563
}
@@ -69,10 +67,9 @@ public ApiResponse<Void> deleteComment(
6967
public ApiResponse<UpdateCommentResponse> updateComment(
7068
@PathVariable Long perspectiveId,
7169
@PathVariable Long commentId,
70+
@AuthenticationPrincipal Long userId,
7271
@RequestBody @Valid UpdateCommentRequest request
7372
) {
74-
// TODO: Security 적용 후 @AuthenticationPrincipal로 userId 교체
75-
Long userId = 1L;
7673
return ApiResponse.onSuccess(commentService.updateComment(perspectiveId, commentId, userId, request));
7774
}
7875
}

src/main/java/com/swyp/app/domain/perspective/controller/PerspectiveController.java

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import io.swagger.v3.oas.annotations.tags.Tag;
1313
import jakarta.validation.Valid;
1414
import lombok.RequiredArgsConstructor;
15+
import org.springframework.security.core.annotation.AuthenticationPrincipal;
1516
import org.springframework.web.bind.annotation.DeleteMapping;
1617
import org.springframework.web.bind.annotation.GetMapping;
1718
import org.springframework.web.bind.annotation.PatchMapping;
@@ -30,53 +31,50 @@ public class PerspectiveController {
3031

3132
private final PerspectiveService perspectiveService;
3233

33-
// TODO: Prevote 의 여부를 Vote 도메인 개발 이후 교체
3434
@Operation(summary = "관점 생성", description = "특정 배틀에 대한 관점을 생성합니다. 사전 투표가 완료된 경우에만 가능합니다.")
3535
@PostMapping("/battles/{battleId}/perspectives")
3636
public ApiResponse<CreatePerspectiveResponse> createPerspective(
3737
@PathVariable Long battleId,
38+
@AuthenticationPrincipal Long userId,
3839
@RequestBody @Valid CreatePerspectiveRequest request
3940
) {
40-
// TODO: Security 적용 후 @AuthenticationPrincipal로 userId 교체
41-
Long userId = 1L;
4241
return ApiResponse.onSuccess(perspectiveService.createPerspective(battleId, userId, request));
4342
}
4443

4544
@Operation(summary = "관점 리스트 조회", description = "특정 배틀의 관점 목록을 커서 기반 페이지네이션으로 조회합니다. optionLabel(A/B)로 필터링 가능합니다.")
4645
@GetMapping("/battles/{battleId}/perspectives")
4746
public ApiResponse<PerspectiveListResponse> getPerspectives(
4847
@PathVariable Long battleId,
48+
@AuthenticationPrincipal Long userId,
4949
@RequestParam(required = false) String cursor,
5050
@RequestParam(required = false) Integer size,
5151
@RequestParam(required = false) String optionLabel
5252
) {
53-
// TODO: Security 적용 후 @AuthenticationPrincipal로 userId 교체
54-
Long userId = 1L;
5553
return ApiResponse.onSuccess(perspectiveService.getPerspectives(battleId, userId, cursor, size, optionLabel));
5654
}
5755

5856
@Operation(summary = "내 PENDING 관점 조회", description = "특정 배틀에서 내가 작성한 관점이 PENDING 상태인 경우 반환합니다. PENDING 관점이 없으면 404를 반환합니다.")
5957
@GetMapping("/battles/{battleId}/perspectives/me/pending")
60-
public ApiResponse<MyPerspectiveResponse> getMyPendingPerspective(@PathVariable Long battleId) {
61-
// TODO: Security 적용 후 @AuthenticationPrincipal로 userId 교체
62-
Long userId = 1L;
58+
public ApiResponse<MyPerspectiveResponse> getMyPendingPerspective(
59+
@PathVariable Long battleId,
60+
@AuthenticationPrincipal Long userId) {
6361
return ApiResponse.onSuccess(perspectiveService.getMyPendingPerspective(battleId, userId));
6462
}
6563

6664
@Operation(summary = "관점 삭제", description = "본인이 작성한 관점을 삭제합니다.")
6765
@DeleteMapping("/perspectives/{perspectiveId}")
68-
public ApiResponse<Void> deletePerspective(@PathVariable Long perspectiveId) {
69-
// TODO: Security 적용 후 @AuthenticationPrincipal로 userId 교체
70-
Long userId = 1L;
66+
public ApiResponse<Void> deletePerspective(
67+
@PathVariable Long perspectiveId,
68+
@AuthenticationPrincipal Long userId) {
7169
perspectiveService.deletePerspective(perspectiveId, userId);
7270
return ApiResponse.onSuccess(null);
7371
}
7472

7573
@Operation(summary = "관점 검수 재시도", description = "검수 실패(MODERATION_FAILED) 상태의 관점에 대해 GPT 검수를 다시 요청합니다.")
7674
@PostMapping("/perspectives/{perspectiveId}/moderation/retry")
77-
public ApiResponse<Void> retryModeration(@PathVariable Long perspectiveId) {
78-
// TODO: Security 적용 후 @AuthenticationPrincipal로 userId 교체
79-
Long userId = 1L;
75+
public ApiResponse<Void> retryModeration(
76+
@PathVariable Long perspectiveId,
77+
@AuthenticationPrincipal Long userId) {
8078
perspectiveService.retryModeration(perspectiveId, userId);
8179
return ApiResponse.onSuccess(null);
8280
}
@@ -85,10 +83,9 @@ public ApiResponse<Void> retryModeration(@PathVariable Long perspectiveId) {
8583
@PatchMapping("/perspectives/{perspectiveId}")
8684
public ApiResponse<UpdatePerspectiveResponse> updatePerspective(
8785
@PathVariable Long perspectiveId,
86+
@AuthenticationPrincipal Long userId,
8887
@RequestBody @Valid UpdatePerspectiveRequest request
8988
) {
90-
// TODO: Security 적용 후 @AuthenticationPrincipal로 userId 교체
91-
Long userId = 1L;
9289
return ApiResponse.onSuccess(perspectiveService.updatePerspective(perspectiveId, userId, request));
9390
}
9491
}

src/main/java/com/swyp/app/domain/perspective/controller/PerspectiveLikeController.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import io.swagger.v3.oas.annotations.Operation;
88
import io.swagger.v3.oas.annotations.tags.Tag;
99
import lombok.RequiredArgsConstructor;
10+
import org.springframework.security.core.annotation.AuthenticationPrincipal;
1011
import org.springframework.web.bind.annotation.DeleteMapping;
1112
import org.springframework.web.bind.annotation.GetMapping;
1213
import org.springframework.web.bind.annotation.PathVariable;
@@ -30,17 +31,17 @@ public ApiResponse<LikeCountResponse> getLikeCount(@PathVariable Long perspectiv
3031

3132
@Operation(summary = "좋아요 등록", description = "특정 관점에 좋아요를 등록합니다.")
3233
@PostMapping("/perspectives/{perspectiveId}/likes")
33-
public ApiResponse<LikeResponse> addLike(@PathVariable Long perspectiveId) {
34-
// TODO: Security 적용 후 @AuthenticationPrincipal로 userId 교체
35-
Long userId = 1L;
34+
public ApiResponse<LikeResponse> addLike(
35+
@PathVariable Long perspectiveId,
36+
@AuthenticationPrincipal Long userId) {
3637
return ApiResponse.onSuccess(likeService.addLike(perspectiveId, userId));
3738
}
3839

3940
@Operation(summary = "좋아요 취소", description = "특정 관점에 등록한 좋아요를 취소합니다.")
4041
@DeleteMapping("/perspectives/{perspectiveId}/likes")
41-
public ApiResponse<LikeResponse> removeLike(@PathVariable Long perspectiveId) {
42-
// TODO: Security 적용 후 @AuthenticationPrincipal로 userId 교체
43-
Long userId = 1L;
42+
public ApiResponse<LikeResponse> removeLike(
43+
@PathVariable Long perspectiveId,
44+
@AuthenticationPrincipal Long userId) {
4445
return ApiResponse.onSuccess(likeService.removeLike(perspectiveId, userId));
4546
}
4647
}

src/main/java/com/swyp/app/domain/perspective/entity/Perspective.java

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
package com.swyp.app.domain.perspective.entity;
22

3+
import com.swyp.app.domain.battle.entity.Battle;
4+
import com.swyp.app.domain.battle.entity.BattleOption;
35
import com.swyp.app.domain.perspective.enums.PerspectiveStatus;
6+
import com.swyp.app.domain.user.entity.User;
47
import com.swyp.app.global.common.BaseEntity;
58
import jakarta.persistence.Column;
69
import jakarta.persistence.Entity;
710
import jakarta.persistence.EnumType;
811
import jakarta.persistence.Enumerated;
9-
import jakarta.persistence.GeneratedValue;
10-
import jakarta.persistence.GenerationType;
11-
import jakarta.persistence.Id;
12+
import jakarta.persistence.FetchType;
13+
import jakarta.persistence.JoinColumn;
14+
import jakarta.persistence.ManyToOne;
1215
import jakarta.persistence.Table;
1316
import jakarta.persistence.UniqueConstraint;
1417
import lombok.AccessLevel;
@@ -25,17 +28,17 @@
2528
@NoArgsConstructor(access = AccessLevel.PROTECTED)
2629
public class Perspective extends BaseEntity {
2730

28-
// TODO: Battle 엔티티 병합 후 @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "battle_id") 로 교체
29-
@Column(name = "battle_id", nullable = false)
30-
private Long battleId;
31+
@ManyToOne(fetch = FetchType.LAZY)
32+
@JoinColumn(name = "battle_id", nullable = false)
33+
private Battle battle;
3134

32-
// TODO: User 엔티티 병합 후 @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "user_id") 로 교체
33-
@Column(name = "user_id", nullable = false)
34-
private Long userId;
35+
@ManyToOne(fetch = FetchType.LAZY)
36+
@JoinColumn(name = "user_id", nullable = false)
37+
private User user;
3538

36-
// TODO: BattleOption 엔티티 병합 후 @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "option_id") 로 교체
37-
@Column(name = "option_id", nullable = false)
38-
private Long optionId;
39+
@ManyToOne(fetch = FetchType.LAZY)
40+
@JoinColumn(name = "option_id", nullable = false)
41+
private BattleOption option;
3942

4043
@Column(nullable = false, columnDefinition = "TEXT")
4144
private String content;
@@ -51,10 +54,10 @@ public class Perspective extends BaseEntity {
5154
private PerspectiveStatus status;
5255

5356
@Builder
54-
private Perspective(Long battleId, Long userId, Long optionId, String content) {
55-
this.battleId = battleId;
56-
this.userId = userId;
57-
this.optionId = optionId;
57+
private Perspective(Battle battle, User user, BattleOption option, String content) {
58+
this.battle = battle;
59+
this.user = user;
60+
this.option = option;
5861
this.content = content;
5962
this.likeCount = 0;
6063
this.commentCount = 0;

src/main/java/com/swyp/app/domain/perspective/entity/PerspectiveComment.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.swyp.app.domain.perspective.entity;
22

3+
import com.swyp.app.domain.user.entity.User;
34
import com.swyp.app.global.common.BaseEntity;
45
import jakarta.persistence.Column;
56
import jakarta.persistence.Entity;
@@ -22,17 +23,17 @@ public class PerspectiveComment extends BaseEntity {
2223
@JoinColumn(name = "perspective_id", nullable = false)
2324
private Perspective perspective;
2425

25-
// TODO: User 엔티티 병합 후 @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "user_id") 로 교체
26-
@Column(name = "user_id", nullable = false)
27-
private Long userId;
26+
@ManyToOne(fetch = FetchType.LAZY)
27+
@JoinColumn(name = "user_id", nullable = false)
28+
private User user;
2829

2930
@Column(nullable = false, columnDefinition = "TEXT")
3031
private String content;
3132

3233
@Builder
33-
private PerspectiveComment(Perspective perspective, Long userId, String content) {
34+
private PerspectiveComment(Perspective perspective, User user, String content) {
3435
this.perspective = perspective;
35-
this.userId = userId;
36+
this.user = user;
3637
this.content = content;
3738
}
3839

src/main/java/com/swyp/app/domain/perspective/entity/PerspectiveLike.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.swyp.app.domain.perspective.entity;
22

3+
import com.swyp.app.domain.user.entity.User;
34
import com.swyp.app.global.common.BaseEntity;
4-
import jakarta.persistence.Column;
55
import jakarta.persistence.Entity;
66
import jakarta.persistence.FetchType;
77
import jakarta.persistence.JoinColumn;
@@ -26,13 +26,13 @@ public class PerspectiveLike extends BaseEntity {
2626
@JoinColumn(name = "perspective_id", nullable = false)
2727
private Perspective perspective;
2828

29-
// TODO: User 엔티티 병합 후 @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "user_id") 로 교체
30-
@Column(name = "user_id", nullable = false)
31-
private Long userId;
29+
@ManyToOne(fetch = FetchType.LAZY)
30+
@JoinColumn(name = "user_id", nullable = false)
31+
private User user;
3232

3333
@Builder
34-
private PerspectiveLike(Perspective perspective, Long userId) {
34+
private PerspectiveLike(Perspective perspective, User user) {
3535
this.perspective = perspective;
36-
this.userId = userId;
36+
this.user = user;
3737
}
3838
}

src/main/java/com/swyp/app/domain/perspective/repository/PerspectiveCommentRepository.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ public interface PerspectiveCommentRepository extends JpaRepository<PerspectiveC
1616

1717
List<PerspectiveComment> findByPerspectiveAndCreatedAtBeforeOrderByCreatedAtDesc(Perspective perspective, LocalDateTime cursor, Pageable pageable);
1818

19-
// MypageService: 사용자 댓글 활동 조회 (offset 페이지네이션)
20-
@Query("SELECT c FROM PerspectiveComment c JOIN FETCH c.perspective WHERE c.userId = :userId ORDER BY c.createdAt DESC")
19+
@Query("SELECT c FROM PerspectiveComment c JOIN FETCH c.perspective WHERE c.user.id = :userId ORDER BY c.createdAt DESC")
2120
List<PerspectiveComment> findByUserIdOrderByCreatedAtDesc(@Param("userId") Long userId, Pageable pageable);
2221

2322
long countByUserId(Long userId);

src/main/java/com/swyp/app/domain/perspective/repository/PerspectiveLikeRepository.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ public interface PerspectiveLikeRepository extends JpaRepository<PerspectiveLike
1818

1919
long countByPerspective(Perspective perspective);
2020

21-
// MypageService: 사용자 좋아요 활동 조회 (offset 페이지네이션)
22-
@Query("SELECT l FROM PerspectiveLike l JOIN FETCH l.perspective WHERE l.userId = :userId ORDER BY l.createdAt DESC")
21+
@Query("SELECT l FROM PerspectiveLike l JOIN FETCH l.perspective WHERE l.user.id = :userId ORDER BY l.createdAt DESC")
2322
List<PerspectiveLike> findByUserIdOrderByCreatedAtDesc(@Param("userId") Long userId, Pageable pageable);
2423

2524
long countByUserId(Long userId);

src/main/java/com/swyp/app/domain/perspective/service/PerspectiveCommentService.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
import com.swyp.app.domain.perspective.repository.PerspectiveCommentRepository;
1111
import com.swyp.app.domain.perspective.repository.PerspectiveRepository;
1212
import com.swyp.app.domain.user.dto.response.UserSummary;
13+
import com.swyp.app.domain.user.entity.User;
14+
import com.swyp.app.domain.user.repository.UserRepository;
1315
import com.swyp.app.domain.user.service.UserService;
1416
import com.swyp.app.global.common.exception.CustomException;
1517
import com.swyp.app.global.common.exception.ErrorCode;
@@ -30,25 +32,28 @@ public class PerspectiveCommentService {
3032

3133
private final PerspectiveRepository perspectiveRepository;
3234
private final PerspectiveCommentRepository commentRepository;
35+
private final UserRepository userRepository;
3336
private final UserService userQueryService;
3437

3538
@Transactional
3639
public CreateCommentResponse createComment(Long perspectiveId, Long userId, CreateCommentRequest request) {
3740
Perspective perspective = findPerspectiveById(perspectiveId);
41+
User user = userRepository.findById(userId)
42+
.orElseThrow(() -> new CustomException(ErrorCode.USER_NOT_FOUND));
3843

3944
PerspectiveComment comment = PerspectiveComment.builder()
4045
.perspective(perspective)
41-
.userId(userId)
46+
.user(user)
4247
.content(request.content())
4348
.build();
4449

4550
commentRepository.save(comment);
4651
perspective.incrementCommentCount();
4752

48-
UserSummary user = userQueryService.findSummaryById(userId);
53+
UserSummary userSummary = userQueryService.findSummaryById(userId);
4954
return new CreateCommentResponse(
5055
comment.getId(),
51-
new CreateCommentResponse.UserSummary(user.userTag(), user.nickname(), user.characterType()),
56+
new CreateCommentResponse.UserSummary(userSummary.userTag(), userSummary.nickname(), userSummary.characterType()),
5257
comment.getContent(),
5358
comment.getCreatedAt()
5459
);
@@ -67,12 +72,12 @@ public CommentListResponse getComments(Long perspectiveId, Long userId, String c
6772

6873
List<CommentListResponse.Item> items = comments.stream()
6974
.map(c -> {
70-
UserSummary user = userQueryService.findSummaryById(c.getUserId());
75+
UserSummary author = userQueryService.findSummaryById(c.getUser().getId());
7176
return new CommentListResponse.Item(
7277
c.getId(),
73-
new CommentListResponse.UserSummary(user.userTag(), user.nickname(), user.characterType()),
78+
new CommentListResponse.UserSummary(author.userTag(), author.nickname(), author.characterType()),
7479
c.getContent(),
75-
c.getUserId().equals(userId),
80+
c.getUser().getId().equals(userId),
7681
c.getCreatedAt()
7782
);
7883
})
@@ -116,7 +121,7 @@ private PerspectiveComment findCommentById(Long commentId) {
116121
}
117122

118123
private void validateOwnership(PerspectiveComment comment, Long userId) {
119-
if (!comment.getUserId().equals(userId)) {
124+
if (!comment.getUser().getId().equals(userId)) {
120125
throw new CustomException(ErrorCode.COMMENT_FORBIDDEN);
121126
}
122127
}

0 commit comments

Comments
 (0)