diff --git a/src/docs/asciidoc/api/pick-commnet/pick-comment-modify.adoc b/src/docs/asciidoc/api/pick-commnet/pick-comment-modify.adoc index 4904225c..c6546a80 100644 --- a/src/docs/asciidoc/api/pick-commnet/pick-comment-modify.adoc +++ b/src/docs/asciidoc/api/pick-commnet/pick-comment-modify.adoc @@ -2,7 +2,9 @@ == 픽픽픽 댓글/답글 수정 API(PATCH: /devdevdev/api/v1/picks/{pickId}/comments/{pickCommentId}) * 픽픽픽 댓글/답글을 수정한다. -* 회원 본인이 작성한 픽픽픽 댓글/답글을 수정 할 수 있다. +** 회원인 경우 토큰을 `Authorization` 헤더에 포함시켜야 한다. +** 익명 회원인 경우 `Anonymous-Member-Id` 헤더에 익명 회원 아이디를 포함시켜야 한다. +* 회원 또는 익명회원 본인이 작성한 픽픽픽 댓글/답글 만 수정 할 수 있다. * 픽픽픽 공개 여부는 수정 할 수 없다. * 삭제된 댓글/답글을 수정 할 수 없다. @@ -41,5 +43,6 @@ include::{snippets}/modify-pick-comment/response-fields.adoc[] * `승인 상태가 아닌 픽픽픽에는 댓글을 수정할 수 없습니다.`: 픽픽픽이 승인 상태가 아닌 경우 * `익명 회원은 사용할 수 없는 기능 입니다.`: 익명 회원인 경우 * `회원을 찾을 수 없습니다.`: 회원이 존재하지 않는 경우 +* `익명 사용자가 아닙니다. 잘못된 메소드 호출 입니다.`: 회원이 익명 회원 메소드를 호출한 경우 include::{snippets}/modify-pick-comment-bind-exception/response-body.adoc[] \ No newline at end of file diff --git a/src/main/java/com/dreamypatisiel/devdevdev/domain/repository/pick/PickCommentRepository.java b/src/main/java/com/dreamypatisiel/devdevdev/domain/repository/pick/PickCommentRepository.java index 85c9ebb9..ce8dc401 100644 --- a/src/main/java/com/dreamypatisiel/devdevdev/domain/repository/pick/PickCommentRepository.java +++ b/src/main/java/com/dreamypatisiel/devdevdev/domain/repository/pick/PickCommentRepository.java @@ -16,6 +16,10 @@ public interface PickCommentRepository extends JpaRepository, Optional findWithPickByIdAndPickIdAndCreatedByIdAndDeletedAtIsNull(Long id, Long pickId, Long createdById); + @EntityGraph(attributePaths = {"pick"}) + Optional findWithPickByIdAndPickIdAndCreatedAnonymousByIdAndDeletedAtIsNull(Long id, Long pickId, + Long createdAnonymousById); + Optional findByIdAndPickIdAndDeletedAtIsNull(Long id, Long pickId); @EntityGraph(attributePaths = {"pick"}) diff --git a/src/main/java/com/dreamypatisiel/devdevdev/domain/service/pick/GuestPickCommentService.java b/src/main/java/com/dreamypatisiel/devdevdev/domain/service/pick/GuestPickCommentService.java index eaa67ba9..f6fbb5d9 100644 --- a/src/main/java/com/dreamypatisiel/devdevdev/domain/service/pick/GuestPickCommentService.java +++ b/src/main/java/com/dreamypatisiel/devdevdev/domain/service/pick/GuestPickCommentService.java @@ -10,10 +10,10 @@ import com.dreamypatisiel.devdevdev.domain.repository.pick.PickCommentSort; import com.dreamypatisiel.devdevdev.domain.repository.pick.PickRepository; import com.dreamypatisiel.devdevdev.domain.service.pick.dto.PickCommentDto; +import com.dreamypatisiel.devdevdev.global.common.TimeProvider; import com.dreamypatisiel.devdevdev.global.utils.AuthenticationMemberUtils; import com.dreamypatisiel.devdevdev.openai.embeddings.EmbeddingsService; import com.dreamypatisiel.devdevdev.web.dto.SliceCustom; -import com.dreamypatisiel.devdevdev.web.dto.request.pick.ModifyPickCommentRequest; import com.dreamypatisiel.devdevdev.web.dto.response.pick.PickCommentRecommendResponse; import com.dreamypatisiel.devdevdev.web.dto.response.pick.PickCommentResponse; import com.dreamypatisiel.devdevdev.web.dto.response.pick.PickCommentsResponse; @@ -32,12 +32,13 @@ public class GuestPickCommentService extends PickCommonService implements PickCo public GuestPickCommentService(EmbeddingsService embeddingsService, PickBestCommentsPolicy pickBestCommentsPolicy, + TimeProvider timeProvider, PickRepository pickRepository, PickPopularScorePolicy pickPopularScorePolicy, PickCommentRepository pickCommentRepository, PickCommentRecommendRepository pickCommentRecommendRepository) { - super(embeddingsService, pickBestCommentsPolicy, pickPopularScorePolicy, pickRepository, pickCommentRepository, - pickCommentRecommendRepository); + super(embeddingsService, pickBestCommentsPolicy, pickPopularScorePolicy, timeProvider, pickRepository, + pickCommentRepository, pickCommentRecommendRepository); } @Override @@ -56,7 +57,7 @@ public PickCommentResponse registerPickRepliedComment(Long pickParentCommentId, @Override public PickCommentResponse modifyPickComment(Long pickCommentId, Long pickId, - ModifyPickCommentRequest modifyPickCommentRequest, + PickCommentDto pickModifyCommentDto, Authentication authentication) { throw new AccessDeniedException(INVALID_ANONYMOUS_CAN_NOT_USE_THIS_FUNCTION_MESSAGE); diff --git a/src/main/java/com/dreamypatisiel/devdevdev/domain/service/pick/GuestPickCommentServiceV2.java b/src/main/java/com/dreamypatisiel/devdevdev/domain/service/pick/GuestPickCommentServiceV2.java index 5f5734f3..98b145f3 100644 --- a/src/main/java/com/dreamypatisiel/devdevdev/domain/service/pick/GuestPickCommentServiceV2.java +++ b/src/main/java/com/dreamypatisiel/devdevdev/domain/service/pick/GuestPickCommentServiceV2.java @@ -2,6 +2,7 @@ import static com.dreamypatisiel.devdevdev.domain.exception.GuestExceptionMessage.INVALID_ANONYMOUS_CAN_NOT_USE_THIS_FUNCTION_MESSAGE; import static com.dreamypatisiel.devdevdev.domain.exception.PickExceptionMessage.INVALID_NOT_APPROVAL_STATUS_PICK_COMMENT_MESSAGE; +import static com.dreamypatisiel.devdevdev.domain.exception.PickExceptionMessage.INVALID_NOT_FOUND_PICK_COMMENT_MESSAGE; import static com.dreamypatisiel.devdevdev.domain.exception.PickExceptionMessage.INVALID_NOT_FOUND_PICK_MESSAGE; import static com.dreamypatisiel.devdevdev.domain.exception.PickExceptionMessage.INVALID_NOT_FOUND_PICK_VOTE_MESSAGE; @@ -21,10 +22,10 @@ import com.dreamypatisiel.devdevdev.domain.service.member.AnonymousMemberService; import com.dreamypatisiel.devdevdev.domain.service.pick.dto.PickCommentDto; import com.dreamypatisiel.devdevdev.exception.NotFoundException; +import com.dreamypatisiel.devdevdev.global.common.TimeProvider; import com.dreamypatisiel.devdevdev.global.utils.AuthenticationMemberUtils; import com.dreamypatisiel.devdevdev.openai.embeddings.EmbeddingsService; import com.dreamypatisiel.devdevdev.web.dto.SliceCustom; -import com.dreamypatisiel.devdevdev.web.dto.request.pick.ModifyPickCommentRequest; import com.dreamypatisiel.devdevdev.web.dto.response.pick.PickCommentRecommendResponse; import com.dreamypatisiel.devdevdev.web.dto.response.pick.PickCommentResponse; import com.dreamypatisiel.devdevdev.web.dto.response.pick.PickCommentsResponse; @@ -46,13 +47,14 @@ public class GuestPickCommentServiceV2 extends PickCommonService implements Pick public GuestPickCommentServiceV2(EmbeddingsService embeddingsService, PickBestCommentsPolicy pickBestCommentsPolicy, + TimeProvider timeProvider, PickRepository pickRepository, PickCommentRepository pickCommentRepository, PickCommentRecommendRepository pickCommentRecommendRepository, AnonymousMemberService anonymousMemberService, PickPopularScorePolicy pickPopularScorePolicy, PickVoteRepository pickVoteRepository) { - super(embeddingsService, pickBestCommentsPolicy, pickPopularScorePolicy, pickRepository, + super(embeddingsService, pickBestCommentsPolicy, pickPopularScorePolicy, timeProvider, pickRepository, pickCommentRepository, pickCommentRecommendRepository); this.anonymousMemberService = anonymousMemberService; this.pickVoteRepository = pickVoteRepository; @@ -109,14 +111,14 @@ public PickCommentResponse registerPickComment(Long pickId, PickCommentDto pickC @Override @Transactional public PickCommentResponse registerPickRepliedComment(Long pickParentCommentId, Long pickCommentOriginParentId, - Long pickId, PickCommentDto pickCommentDto, + Long pickId, PickCommentDto pickRegisterRepliedCommentDto, Authentication authentication) { // 익명 회원인지 검증 AuthenticationMemberUtils.validateAnonymousMethodCall(authentication); - String contents = pickCommentDto.getContents(); - String anonymousMemberId = pickCommentDto.getAnonymousMemberId(); + String contents = pickRegisterRepliedCommentDto.getContents(); + String anonymousMemberId = pickRegisterRepliedCommentDto.getAnonymousMemberId(); // 익명 회원 추출 AnonymousMember anonymousMember = anonymousMemberService.findOrCreateAnonymousMember(anonymousMemberId); @@ -137,11 +139,31 @@ public PickCommentResponse registerPickRepliedComment(Long pickParentCommentId, } @Override - public PickCommentResponse modifyPickComment(Long pickCommentId, Long pickId, - ModifyPickCommentRequest modifyPickCommentRequest, + public PickCommentResponse modifyPickComment(Long pickCommentId, Long pickId, PickCommentDto pickCommentDto, Authentication authentication) { - throw new AccessDeniedException(INVALID_ANONYMOUS_CAN_NOT_USE_THIS_FUNCTION_MESSAGE); + // 익명 회원인지 검증 + AuthenticationMemberUtils.validateAnonymousMethodCall(authentication); + + String contents = pickCommentDto.getContents(); + String anonymousMemberId = pickCommentDto.getAnonymousMemberId(); + + // 익명 회원 추출 + AnonymousMember anonymousMember = anonymousMemberService.findOrCreateAnonymousMember(anonymousMemberId); + + // 픽픽픽 댓글 조회(익명 회원 본인이 댓글 작성, 삭제되지 않은 댓글) + PickComment findPickComment = pickCommentRepository.findWithPickByIdAndPickIdAndCreatedAnonymousByIdAndDeletedAtIsNull( + pickCommentId, pickId, anonymousMember.getId()) + .orElseThrow(() -> new NotFoundException(INVALID_NOT_FOUND_PICK_COMMENT_MESSAGE)); + + // 픽픽픽 게시글의 승인 상태 검증 + validateIsApprovalPickContentStatus(findPickComment.getPick(), INVALID_NOT_APPROVAL_STATUS_PICK_COMMENT_MESSAGE, + MODIFY); + + // 댓글 수정 + findPickComment.modifyCommentContents(new CommentContents(contents), timeProvider.getLocalDateTimeNow()); + + return new PickCommentResponse(findPickComment.getId()); } @Override diff --git a/src/main/java/com/dreamypatisiel/devdevdev/domain/service/pick/GuestPickService.java b/src/main/java/com/dreamypatisiel/devdevdev/domain/service/pick/GuestPickService.java index cbad78dc..afc2f82d 100644 --- a/src/main/java/com/dreamypatisiel/devdevdev/domain/service/pick/GuestPickService.java +++ b/src/main/java/com/dreamypatisiel/devdevdev/domain/service/pick/GuestPickService.java @@ -56,7 +56,6 @@ public class GuestPickService extends PickCommonService implements PickService { public static final String INVALID_ANONYMOUS_CAN_NOT_USE_THIS_FUNCTION_MESSAGE = "비회원은 현재 해당 기능을 이용할 수 없습니다."; private final PickVoteRepository pickVoteRepository; - private final TimeProvider timeProvider; private final AnonymousMemberService anonymousMemberService; public GuestPickService(PickRepository pickRepository, EmbeddingsService embeddingsService, @@ -66,11 +65,10 @@ public GuestPickService(PickRepository pickRepository, EmbeddingsService embeddi PickPopularScorePolicy pickPopularScorePolicy, PickVoteRepository pickVoteRepository, TimeProvider timeProvider, AnonymousMemberService anonymousMemberService) { - super(embeddingsService, pickBestCommentsPolicy, pickPopularScorePolicy, pickRepository, pickCommentRepository, - pickCommentRecommendRepository); + super(embeddingsService, pickBestCommentsPolicy, pickPopularScorePolicy, timeProvider, pickRepository, + pickCommentRepository, pickCommentRecommendRepository); this.pickVoteRepository = pickVoteRepository; this.anonymousMemberService = anonymousMemberService; - this.timeProvider = timeProvider; } @Transactional diff --git a/src/main/java/com/dreamypatisiel/devdevdev/domain/service/pick/MemberPickCommentService.java b/src/main/java/com/dreamypatisiel/devdevdev/domain/service/pick/MemberPickCommentService.java index 4a109d4a..143b9aae 100644 --- a/src/main/java/com/dreamypatisiel/devdevdev/domain/service/pick/MemberPickCommentService.java +++ b/src/main/java/com/dreamypatisiel/devdevdev/domain/service/pick/MemberPickCommentService.java @@ -26,7 +26,6 @@ import com.dreamypatisiel.devdevdev.global.common.TimeProvider; import com.dreamypatisiel.devdevdev.openai.embeddings.EmbeddingsService; import com.dreamypatisiel.devdevdev.web.dto.SliceCommentCustom; -import com.dreamypatisiel.devdevdev.web.dto.request.pick.ModifyPickCommentRequest; import com.dreamypatisiel.devdevdev.web.dto.response.pick.PickCommentRecommendResponse; import com.dreamypatisiel.devdevdev.web.dto.response.pick.PickCommentResponse; import com.dreamypatisiel.devdevdev.web.dto.response.pick.PickCommentsResponse; @@ -42,7 +41,6 @@ @Transactional(readOnly = true) public class MemberPickCommentService extends PickCommonService implements PickCommentService { - private final TimeProvider timeProvider; private final MemberProvider memberProvider; private final PickRepository pickRepository; @@ -55,9 +53,8 @@ public MemberPickCommentService(TimeProvider timeProvider, MemberProvider member PickRepository pickRepository, PickVoteRepository pickVoteRepository, PickCommentRepository pickCommentRepository, PickCommentRecommendRepository pickCommentRecommendRepository) { - super(embeddingsService, pickBestCommentsPolicy, pickPopularScorePolicy, pickRepository, pickCommentRepository, - pickCommentRecommendRepository); - this.timeProvider = timeProvider; + super(embeddingsService, pickBestCommentsPolicy, pickPopularScorePolicy, timeProvider, pickRepository, + pickCommentRepository, pickCommentRecommendRepository); this.memberProvider = memberProvider; this.pickRepository = pickRepository; this.pickVoteRepository = pickVoteRepository; @@ -151,10 +148,10 @@ public PickCommentResponse registerPickRepliedComment(Long pickParentCommentId, */ @Transactional public PickCommentResponse modifyPickComment(Long pickCommentId, Long pickId, - ModifyPickCommentRequest modifyPickCommentRequest, + PickCommentDto pickModifyCommentDto, Authentication authentication) { - String contents = modifyPickCommentRequest.getContents(); + String contents = pickModifyCommentDto.getContents(); // 회원 조회 Member findMember = memberProvider.getMemberByAuthentication(authentication); diff --git a/src/main/java/com/dreamypatisiel/devdevdev/domain/service/pick/MemberPickService.java b/src/main/java/com/dreamypatisiel/devdevdev/domain/service/pick/MemberPickService.java index 3bf47be8..d907a0fb 100644 --- a/src/main/java/com/dreamypatisiel/devdevdev/domain/service/pick/MemberPickService.java +++ b/src/main/java/com/dreamypatisiel/devdevdev/domain/service/pick/MemberPickService.java @@ -86,8 +86,6 @@ public class MemberPickService extends PickCommonService implements PickService private final PickOptionImageRepository pickOptionImageRepository; private final PickVoteRepository pickVoteRepository; - private final TimeProvider timeProvider; - public MemberPickService(EmbeddingsService embeddingsService, PickRepository pickRepository, AwsS3Properties awsS3Properties, AwsS3Uploader awsS3Uploader, MemberProvider memberProvider, PickOptionRepository pickOptionRepository, @@ -96,7 +94,8 @@ public MemberPickService(EmbeddingsService embeddingsService, PickRepository pic PickCommentRecommendRepository pickCommentRecommendRepository, PickPopularScorePolicy pickPopularScorePolicy, PickBestCommentsPolicy pickBestCommentsPolicy, TimeProvider timeProvider) { - super(embeddingsService, pickBestCommentsPolicy, pickPopularScorePolicy, pickRepository, pickCommentRepository, + super(embeddingsService, pickBestCommentsPolicy, pickPopularScorePolicy, timeProvider, pickRepository, + pickCommentRepository, pickCommentRecommendRepository); this.awsS3Properties = awsS3Properties; this.awsS3Uploader = awsS3Uploader; @@ -104,7 +103,6 @@ public MemberPickService(EmbeddingsService embeddingsService, PickRepository pic this.pickOptionRepository = pickOptionRepository; this.pickOptionImageRepository = pickOptionImageRepository; this.pickVoteRepository = pickVoteRepository; - this.timeProvider = timeProvider; } /** diff --git a/src/main/java/com/dreamypatisiel/devdevdev/domain/service/pick/PickCommentService.java b/src/main/java/com/dreamypatisiel/devdevdev/domain/service/pick/PickCommentService.java index 2311132e..aaa6cb28 100644 --- a/src/main/java/com/dreamypatisiel/devdevdev/domain/service/pick/PickCommentService.java +++ b/src/main/java/com/dreamypatisiel/devdevdev/domain/service/pick/PickCommentService.java @@ -4,7 +4,6 @@ import com.dreamypatisiel.devdevdev.domain.repository.pick.PickCommentSort; import com.dreamypatisiel.devdevdev.domain.service.pick.dto.PickCommentDto; import com.dreamypatisiel.devdevdev.web.dto.SliceCustom; -import com.dreamypatisiel.devdevdev.web.dto.request.pick.ModifyPickCommentRequest; import com.dreamypatisiel.devdevdev.web.dto.response.pick.PickCommentRecommendResponse; import com.dreamypatisiel.devdevdev.web.dto.response.pick.PickCommentResponse; import com.dreamypatisiel.devdevdev.web.dto.response.pick.PickCommentsResponse; @@ -19,28 +18,22 @@ public interface PickCommentService { String DELETE = "삭제"; String RECOMMEND = "추천"; - PickCommentResponse registerPickComment(Long pickId, - PickCommentDto pickRegisterCommentDto, - Authentication authentication); + PickCommentResponse registerPickComment(Long pickId, PickCommentDto pickRegisterCommentDto, Authentication authentication); - PickCommentResponse registerPickRepliedComment(Long pickParentCommentId, - Long pickCommentOriginParentId, - Long pickId, PickCommentDto pickCommentDto, + PickCommentResponse registerPickRepliedComment(Long pickParentCommentId, Long pickCommentOriginParentId, + Long pickId, PickCommentDto pickRegisterRepliedCommentDto, Authentication authentication); - PickCommentResponse modifyPickComment(Long pickCommentId, Long pickId, - ModifyPickCommentRequest modifyPickCommentRequest, + PickCommentResponse modifyPickComment(Long pickCommentId, Long pickId, PickCommentDto pickModifyCommentDto, Authentication authentication); PickCommentResponse deletePickComment(Long pickCommentId, Long pickId, Authentication authentication); - SliceCustom findPickComments(Pageable pageable, Long pickId, - Long pickCommentId, PickCommentSort pickCommentSort, - EnumSet pickOptionTypes, + SliceCustom findPickComments(Pageable pageable, Long pickId, Long pickCommentId, + PickCommentSort pickCommentSort, EnumSet pickOptionTypes, Authentication authentication); - PickCommentRecommendResponse recommendPickComment(Long pickId, Long pickCommendId, - Authentication authentication); + PickCommentRecommendResponse recommendPickComment(Long pickId, Long pickCommendId, Authentication authentication); List findPickBestComments(int size, Long pickId, Authentication authentication); } diff --git a/src/main/java/com/dreamypatisiel/devdevdev/domain/service/pick/PickCommonService.java b/src/main/java/com/dreamypatisiel/devdevdev/domain/service/pick/PickCommonService.java index 89c73faf..87c7b332 100644 --- a/src/main/java/com/dreamypatisiel/devdevdev/domain/service/pick/PickCommonService.java +++ b/src/main/java/com/dreamypatisiel/devdevdev/domain/service/pick/PickCommonService.java @@ -20,6 +20,7 @@ import com.dreamypatisiel.devdevdev.domain.repository.pick.PickRepository; import com.dreamypatisiel.devdevdev.exception.InternalServerException; import com.dreamypatisiel.devdevdev.exception.NotFoundException; +import com.dreamypatisiel.devdevdev.global.common.TimeProvider; import com.dreamypatisiel.devdevdev.openai.data.response.PickWithSimilarityDto; import com.dreamypatisiel.devdevdev.openai.embeddings.EmbeddingsService; import com.dreamypatisiel.devdevdev.web.dto.SliceCommentCustom; @@ -52,6 +53,7 @@ public class PickCommonService { private final PickBestCommentsPolicy pickBestCommentsPolicy; protected final PickPopularScorePolicy pickPopularScorePolicy; + protected final TimeProvider timeProvider; protected final PickRepository pickRepository; protected final PickCommentRepository pickCommentRepository; protected final PickCommentRecommendRepository pickCommentRecommendRepository; diff --git a/src/main/java/com/dreamypatisiel/devdevdev/domain/service/pick/dto/PickCommentDto.java b/src/main/java/com/dreamypatisiel/devdevdev/domain/service/pick/dto/PickCommentDto.java index 8895b8fb..9e348b05 100644 --- a/src/main/java/com/dreamypatisiel/devdevdev/domain/service/pick/dto/PickCommentDto.java +++ b/src/main/java/com/dreamypatisiel/devdevdev/domain/service/pick/dto/PickCommentDto.java @@ -1,5 +1,6 @@ package com.dreamypatisiel.devdevdev.domain.service.pick.dto; +import com.dreamypatisiel.devdevdev.web.dto.request.pick.ModifyPickCommentRequest; import com.dreamypatisiel.devdevdev.web.dto.request.pick.RegisterPickCommentRequest; import com.dreamypatisiel.devdevdev.web.dto.request.pick.RegisterPickRepliedCommentRequest; import lombok.Builder; @@ -34,4 +35,12 @@ public static PickCommentDto createRepliedCommentDto(RegisterPickRepliedCommentR .anonymousMemberId(anonymousMemberId) .build(); } + + public static PickCommentDto createModifyCommentDto(ModifyPickCommentRequest modifyPickCommentRequest, + String anonymousMemberId) { + return PickCommentDto.builder() + .contents(modifyPickCommentRequest.getContents()) + .anonymousMemberId(anonymousMemberId) + .build(); + } } diff --git a/src/main/java/com/dreamypatisiel/devdevdev/web/controller/pick/PickCommentController.java b/src/main/java/com/dreamypatisiel/devdevdev/web/controller/pick/PickCommentController.java index 7b7d9972..610e468a 100644 --- a/src/main/java/com/dreamypatisiel/devdevdev/web/controller/pick/PickCommentController.java +++ b/src/main/java/com/dreamypatisiel/devdevdev/web/controller/pick/PickCommentController.java @@ -87,7 +87,7 @@ public ResponseEntity> registerPickRepliedCom return ResponseEntity.ok(BasicResponse.success(pickCommentResponse)); } - @Operation(summary = "픽픽픽 댓글/답글 수정", description = "회원은 자신이 작성한 픽픽픽 댓글/답글을 수정할 수 있습니다.") + @Operation(summary = "픽픽픽 댓글/답글 수정", description = "회원/익명회원 본인이 작성한 픽픽픽 댓글/답글만 수정할 수 있습니다.") @PatchMapping("/picks/{pickId}/comments/{pickCommentId}") public ResponseEntity> modifyPickComment( @PathVariable Long pickId, @@ -95,15 +95,19 @@ public ResponseEntity> modifyPickComment( @RequestBody @Validated ModifyPickCommentRequest modifyPickCommentRequest) { Authentication authentication = AuthenticationMemberUtils.getAuthentication(); + String anonymousMemberId = HttpRequestUtils.getHeaderValue(HEADER_ANONYMOUS_MEMBER_ID); + + PickCommentDto modifyCommentDto = PickCommentDto.createModifyCommentDto(modifyPickCommentRequest, + anonymousMemberId); PickCommentService pickCommentService = pickServiceStrategy.pickCommentService(); PickCommentResponse pickCommentResponse = pickCommentService.modifyPickComment(pickCommentId, pickId, - modifyPickCommentRequest, authentication); + modifyCommentDto, authentication); return ResponseEntity.ok(BasicResponse.success(pickCommentResponse)); } - @Operation(summary = "픽픽픽 댓글/답글 조회", description = "회원은 픽픽픽 댓글/답글을 조회할 수 있습니다.") + @Operation(summary = "픽픽픽 댓글/답글 조회", description = "픽픽픽 댓글/답글을 조회할 수 있습니다.") @GetMapping("/picks/{pickId}/comments") public ResponseEntity>> getPickComments( @PageableDefault(size = 5, sort = "id", direction = Direction.DESC) Pageable pageable, diff --git a/src/test/java/com/dreamypatisiel/devdevdev/domain/service/pick/GuestPickCommentServiceV2Test.java b/src/test/java/com/dreamypatisiel/devdevdev/domain/service/pick/GuestPickCommentServiceV2Test.java index edfbce7b..edfb86e4 100644 --- a/src/test/java/com/dreamypatisiel/devdevdev/domain/service/pick/GuestPickCommentServiceV2Test.java +++ b/src/test/java/com/dreamypatisiel/devdevdev/domain/service/pick/GuestPickCommentServiceV2Test.java @@ -6,6 +6,7 @@ import static com.dreamypatisiel.devdevdev.domain.exception.PickExceptionMessage.INVALID_NOT_FOUND_PICK_COMMENT_MESSAGE; import static com.dreamypatisiel.devdevdev.domain.exception.PickExceptionMessage.INVALID_NOT_FOUND_PICK_MESSAGE; import static com.dreamypatisiel.devdevdev.domain.exception.PickExceptionMessage.INVALID_NOT_FOUND_PICK_VOTE_MESSAGE; +import static com.dreamypatisiel.devdevdev.domain.service.pick.PickCommentService.MODIFY; import static com.dreamypatisiel.devdevdev.domain.service.pick.PickCommentService.REGISTER; import static com.dreamypatisiel.devdevdev.domain.service.pick.PickTestUtils.createPick; import static com.dreamypatisiel.devdevdev.domain.service.pick.PickTestUtils.createPickComment; @@ -53,6 +54,7 @@ import com.dreamypatisiel.devdevdev.global.security.oauth2.model.SocialMemberDto; import com.dreamypatisiel.devdevdev.global.security.oauth2.model.UserPrincipal; import com.dreamypatisiel.devdevdev.global.utils.AuthenticationMemberUtils; +import com.dreamypatisiel.devdevdev.web.dto.request.pick.ModifyPickCommentRequest; import com.dreamypatisiel.devdevdev.web.dto.request.pick.RegisterPickRepliedCommentRequest; import com.dreamypatisiel.devdevdev.web.dto.response.pick.PickCommentResponse; import jakarta.persistence.EntityManager; @@ -398,9 +400,9 @@ void registerPickRepliedComment(Boolean isPublic) { pickCommentRepository.save(pickComment); // 픽픽픽 답글 생성 - PickComment repliedPickComment = createReplidPickComment(new CommentContents("댓글1의 답글1"), anonymousMember, pick, + PickComment replidPickComment = createReplidPickComment(new CommentContents("댓글1의 답글1"), anonymousMember, pick, pickComment, pickComment); - pickCommentRepository.save(repliedPickComment); + pickCommentRepository.save(replidPickComment); em.flush(); em.clear(); @@ -410,7 +412,7 @@ void registerPickRepliedComment(Boolean isPublic) { // when PickCommentResponse response = guestPickCommentServiceV2.registerPickRepliedComment( - repliedPickComment.getId(), pickComment.getId(), pick.getId(), repliedCommentDto, authentication); + replidPickComment.getId(), pickComment.getId(), pick.getId(), repliedCommentDto, authentication); em.flush(); em.clear(); @@ -427,7 +429,7 @@ void registerPickRepliedComment(Boolean isPublic) { () -> assertThat(findPickComment.getRecommendTotalCount().getCount()).isEqualTo(0L), () -> assertThat(findPickComment.getPick().getId()).isEqualTo(pick.getId()), () -> assertThat(findPickComment.getCreatedAnonymousBy().getId()).isEqualTo(anonymousMember.getId()), - () -> assertThat(findPickComment.getParent().getId()).isEqualTo(repliedPickComment.getId()), + () -> assertThat(findPickComment.getParent().getId()).isEqualTo(replidPickComment.getId()), () -> assertThat(findPickComment.getOriginParent().getId()).isEqualTo(pickComment.getId()), () -> assertThat(findPickComment.getOriginParent().getReplyTotalCount().getCount()).isEqualTo(1L) ); @@ -589,10 +591,10 @@ void registerPickRepliedCommentRepliedDeleted() { pickCommentRepository.save(pickComment); // 삭제상태의 픽픽픽 댓글의 답글 생성 - PickComment repliedPickComment = createReplidPickComment(new CommentContents("댓글1의 답글"), member, pick, + PickComment replidPickComment = createReplidPickComment(new CommentContents("댓글1의 답글"), member, pick, pickComment, pickComment); - repliedPickComment.changeDeletedAtByMember(LocalDateTime.now(), member); - pickCommentRepository.save(repliedPickComment); + replidPickComment.changeDeletedAtByMember(LocalDateTime.now(), member); + pickCommentRepository.save(replidPickComment); RegisterPickRepliedCommentRequest request = new RegisterPickRepliedCommentRequest("댓글1의 답글1의 답글"); PickCommentDto repliedCommentDto = PickCommentDto.createRepliedCommentDto(request, "anonymousMemberId"); @@ -600,7 +602,7 @@ void registerPickRepliedCommentRepliedDeleted() { // when // then assertThatThrownBy( () -> guestPickCommentServiceV2.registerPickRepliedComment( - repliedPickComment.getId(), pickComment.getId(), pick.getId(), repliedCommentDto, authentication)) + replidPickComment.getId(), pickComment.getId(), pick.getId(), repliedCommentDto, authentication)) .isInstanceOf(IllegalArgumentException.class) .hasMessage(INVALID_CAN_NOT_REPLY_DELETED_PICK_COMMENT_MESSAGE, REGISTER); } @@ -631,10 +633,10 @@ void registerPickRepliedCommentRepliedNotFoundException() { pickCommentRepository.save(pickComment); // 삭제상태의 픽픽픽 댓글의 답글(삭제 상태) - PickComment repliedPickComment = createReplidPickComment(new CommentContents("댓글1의 답글"), member, pick, + PickComment replidPickComment = createReplidPickComment(new CommentContents("댓글1의 답글"), member, pick, pickComment, pickComment); - pickCommentRepository.save(repliedPickComment); - repliedPickComment.changeDeletedAtByMember(LocalDateTime.now(), member); + pickCommentRepository.save(replidPickComment); + replidPickComment.changeDeletedAtByMember(LocalDateTime.now(), member); RegisterPickRepliedCommentRequest request = new RegisterPickRepliedCommentRequest("댓글1의 답글1의 답글"); PickCommentDto repliedCommentDto = PickCommentDto.createRepliedCommentDto(request, "anonymousMemberId"); @@ -646,4 +648,226 @@ void registerPickRepliedCommentRepliedNotFoundException() { .isInstanceOf(NotFoundException.class) .hasMessage(INVALID_NOT_FOUND_PICK_COMMENT_MESSAGE); } + + @ParameterizedTest + @ValueSource(booleans = {true, false}) + @DisplayName("승인 상태이고 익명회원 본인이 작성한 삭제되지 않은 픽픽픽 댓글을 수정한다.") + void modifyPickComment(boolean isPublic) { + // given + // 익명회원 생성 + AnonymousMember anonymousMember = AnonymousMember.create("anonymousMemberId", "익명으로 개발하는 댑댑이"); + anonymousMemberRepository.save(anonymousMember); + + Authentication authentication = mock(Authentication.class); + when(authentication.getPrincipal()).thenReturn(AuthenticationMemberUtils.ANONYMOUS_USER); + + // 픽픽픽 작성자 생성 + SocialMemberDto authorSocialMemberDto = createSocialDto("authorId", "author", + nickname, password, "authorDreamy5patisiel@kakao.com", socialType, role); + Member author = Member.createMemberBy(authorSocialMemberDto); + memberRepository.save(author); + + // 픽픽픽 생성 + Pick pick = createPick(new Title("픽픽픽 타이틀"), ContentStatus.APPROVAL, author); + pickRepository.save(pick); + + // 픽픽픽 댓글 생성 + PickComment pickComment = createPickComment(new CommentContents("안녕하세웅"), isPublic, anonymousMember, pick); + pickCommentRepository.save(pickComment); + + em.flush(); + em.clear(); + + ModifyPickCommentRequest request = new ModifyPickCommentRequest("주무세웅"); + PickCommentDto modifyCommentDto = PickCommentDto.createModifyCommentDto(request, anonymousMember.getAnonymousMemberId()); + + // when + PickCommentResponse response = guestPickCommentServiceV2.modifyPickComment(pickComment.getId(), + pick.getId(), modifyCommentDto, authentication); + + // then + PickComment findPickComment = pickCommentRepository.findById(pickComment.getId()).get(); + assertAll( + () -> assertThat(response.getPickCommentId()).isEqualTo(pickComment.getId()), + () -> assertThat(findPickComment.getContents().getCommentContents()).isEqualTo(request.getContents()), + () -> assertThat(findPickComment.getContentsLastModifiedAt()).isNotNull() + ); + } + + @Test + @DisplayName("익명회원이 픽픽픽 댓글을 수정할 때 익명회원 전용 메소드를 호출하지 않으면 예외가 발생한다.") + void modifyPickCommentMemberException() { + // given + // 회원 생성 + SocialMemberDto socialMemberDto = createSocialDto(userId, name, nickname, password, email, socialType, role); + Member member = Member.createMemberBy(socialMemberDto); + + UserPrincipal userPrincipal = UserPrincipal.createByMember(member); + SecurityContext context = SecurityContextHolder.getContext(); + context.setAuthentication(new OAuth2AuthenticationToken(userPrincipal, userPrincipal.getAuthorities(), + userPrincipal.getSocialType().name())); + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + + em.flush(); + em.clear(); + + ModifyPickCommentRequest request = new ModifyPickCommentRequest("주무세웅"); + PickCommentDto modifyCommentDto = PickCommentDto.createModifyCommentDto(request, "anonymousMemberId"); + + // when // then + assertThatThrownBy(() -> guestPickCommentServiceV2.modifyPickComment(0L, 0L, modifyCommentDto, + authentication)) + .isInstanceOf(IllegalStateException.class) + .hasMessage(INVALID_METHODS_CALL_MESSAGE); + } + + @Test + @DisplayName("익명회원이 픽픽픽 댓글을 수정할 때 댓글이 존재하지 않으면 예외가 발생한다.") + void modifyPickCommentNotFoundPickComment() { + // given + // 익명회원 생성 + AnonymousMember anonymousMember = AnonymousMember.create("anonymousMemberId", "익명으로 개발하는 댑댑이"); + anonymousMemberRepository.save(anonymousMember); + + Authentication authentication = mock(Authentication.class); + when(authentication.getPrincipal()).thenReturn(AuthenticationMemberUtils.ANONYMOUS_USER); + + // 픽픽픽 작성자 생성 + SocialMemberDto authorSocialMemberDto = createSocialDto("authorId", "author", + nickname, password, "authorDreamy5patisiel@kakao.com", socialType, role); + Member author = Member.createMemberBy(authorSocialMemberDto); + memberRepository.save(author); + + // 승인 상태 픽픽픽 생성 + Pick pick = createPick(new Title("픽픽픽 타이틀"), ContentStatus.APPROVAL, author); + pickRepository.save(pick); + + em.flush(); + em.clear(); + + ModifyPickCommentRequest request = new ModifyPickCommentRequest("주무세웅"); + PickCommentDto modifyCommentDto = PickCommentDto.createModifyCommentDto(request, anonymousMember.getAnonymousMemberId()); + + // when // then + assertThatThrownBy(() -> guestPickCommentServiceV2.modifyPickComment(0L, pick.getId(), modifyCommentDto, + authentication)) + .isInstanceOf(NotFoundException.class) + .hasMessage(INVALID_NOT_FOUND_PICK_COMMENT_MESSAGE); + } + + @Test + @DisplayName("익명회원이 픽픽픽 댓글을 수정할 때 본인이 작성한 댓글이 존재하지 않으면 예외가 발생한다.") + void modifyPickCommentNotFoundPickCommentOtherMember() { + // given + // 익명회원 생성 + AnonymousMember anonymousMember = AnonymousMember.create("anonymousMemberId", "익명으로 개발하는 댑댑이"); + anonymousMemberRepository.save(anonymousMember); + + Authentication authentication = mock(Authentication.class); + when(authentication.getPrincipal()).thenReturn(AuthenticationMemberUtils.ANONYMOUS_USER); + + // 픽픽픽 작성자 생성 + SocialMemberDto authorSocialMemberDto = createSocialDto("authorId", "author", + nickname, password, "authorDreamy5patisiel@kakao.com", socialType, role); + Member author = Member.createMemberBy(authorSocialMemberDto); + memberRepository.save(author); + + // 승인 상태 픽픽픽 생성 + Pick pick = createPick(new Title("픽픽픽 타이틀"), ContentStatus.APPROVAL, author); + pickRepository.save(pick); + + // 픽픽픽 댓글 생성(다른 사람이 작성) + PickComment pickComment = createPickComment(new CommentContents("안녕하세웅"), false, author, pick); + pickCommentRepository.save(pickComment); + + em.flush(); + em.clear(); + + ModifyPickCommentRequest request = new ModifyPickCommentRequest("주무세웅"); + PickCommentDto modifyCommentDto = PickCommentDto.createModifyCommentDto(request, anonymousMember.getAnonymousMemberId()); + + // when // then + assertThatThrownBy(() -> guestPickCommentServiceV2.modifyPickComment(pickComment.getId(), pick.getId(), modifyCommentDto, + authentication)) + .isInstanceOf(NotFoundException.class) + .hasMessage(INVALID_NOT_FOUND_PICK_COMMENT_MESSAGE); + } + + @Test + @DisplayName("익명회원이 픽픽픽 댓글을 수정할 때 댓글이 삭제 상태이면 예외가 발생한다.") + void modifyPickCommentNotFoundPickCommentIsDeletedAt() { + // given + // 익명회원 생성 + AnonymousMember anonymousMember = AnonymousMember.create("anonymousMemberId", "익명으로 개발하는 댑댑이"); + anonymousMemberRepository.save(anonymousMember); + + Authentication authentication = mock(Authentication.class); + when(authentication.getPrincipal()).thenReturn(AuthenticationMemberUtils.ANONYMOUS_USER); + + // 픽픽픽 작성자 생성 + SocialMemberDto authorSocialMemberDto = createSocialDto("authorId", "author", + nickname, password, "authorDreamy5patisiel@kakao.com", socialType, role); + Member author = Member.createMemberBy(authorSocialMemberDto); + memberRepository.save(author); + + // 승인 상태 픽픽픽 생성 + Pick pick = createPick(new Title("픽픽픽 타이틀"), ContentStatus.APPROVAL, author); + pickRepository.save(pick); + + // 삭제 상태의 픽픽픽 댓글 생성 + PickComment pickComment = createPickComment(new CommentContents("안녕하세웅"), false, anonymousMember, pick); + pickComment.changeDeletedAtByAnonymousMember(LocalDateTime.now(), anonymousMember); + pickCommentRepository.save(pickComment); + + em.flush(); + em.clear(); + + ModifyPickCommentRequest request = new ModifyPickCommentRequest("주무세웅"); + PickCommentDto modifyCommentDto = PickCommentDto.createModifyCommentDto(request, anonymousMember.getAnonymousMemberId()); + + // when // then + assertThatThrownBy(() -> guestPickCommentServiceV2.modifyPickComment(pickComment.getId(), pick.getId(), modifyCommentDto, + authentication)) + .isInstanceOf(NotFoundException.class) + .hasMessage(INVALID_NOT_FOUND_PICK_COMMENT_MESSAGE); + } + + @ParameterizedTest + @EnumSource(value = ContentStatus.class, mode = Mode.EXCLUDE, names = {"APPROVAL"}) + @DisplayName("익명회원이 승인 상태가 아닌 픽픽픽 댓글을 수정할 때 예외가 발생한다.") + void modifyPickCommentNotApproval(ContentStatus contentStatus) { + // given + // 익명회원 생성 + AnonymousMember anonymousMember = AnonymousMember.create("anonymousMemberId", "익명으로 개발하는 댑댑이"); + anonymousMemberRepository.save(anonymousMember); + + Authentication authentication = mock(Authentication.class); + when(authentication.getPrincipal()).thenReturn(AuthenticationMemberUtils.ANONYMOUS_USER); + + // 픽픽픽 작성자 생성 + SocialMemberDto authorSocialMemberDto = createSocialDto("authorId", "author", + nickname, password, "authorDreamy5patisiel@kakao.com", socialType, role); + Member author = Member.createMemberBy(authorSocialMemberDto); + memberRepository.save(author); + + // 승인 상태가 아닌 픽픽픽 생성 + Pick pick = createPick(new Title("픽픽픽 타이틀"), contentStatus, author); + pickRepository.save(pick); + + // 픽픽픽 댓글 생성 + PickComment pickComment = createPickComment(new CommentContents("안녕하세웅"), false, anonymousMember, pick); + pickCommentRepository.save(pickComment); + + em.flush(); + em.clear(); + + ModifyPickCommentRequest request = new ModifyPickCommentRequest("주무세웅"); + PickCommentDto modifyCommentDto = PickCommentDto.createModifyCommentDto(request, anonymousMember.getAnonymousMemberId()); + + // when // then + assertThatThrownBy(() -> guestPickCommentServiceV2.modifyPickComment(pickComment.getId(), pick.getId(), modifyCommentDto, + authentication)) + .isInstanceOf(IllegalArgumentException.class) + .hasMessage(INVALID_NOT_APPROVAL_STATUS_PICK_COMMENT_MESSAGE, MODIFY); + } } \ No newline at end of file diff --git a/src/test/java/com/dreamypatisiel/devdevdev/domain/service/pick/MemberPickCommentServiceTest.java b/src/test/java/com/dreamypatisiel/devdevdev/domain/service/pick/MemberPickCommentServiceTest.java index 5b1f0c11..ff81c9a4 100644 --- a/src/test/java/com/dreamypatisiel/devdevdev/domain/service/pick/MemberPickCommentServiceTest.java +++ b/src/test/java/com/dreamypatisiel/devdevdev/domain/service/pick/MemberPickCommentServiceTest.java @@ -710,10 +710,11 @@ void modifyPickComment(boolean isPublic) { em.clear(); ModifyPickCommentRequest request = new ModifyPickCommentRequest("주무세웅"); + PickCommentDto modifyCommentDto = PickCommentDto.createModifyCommentDto(request, null); // when PickCommentResponse response = memberPickCommentService.modifyPickComment(pickComment.getId(), - pick.getId(), request, authentication); + pick.getId(), modifyCommentDto, authentication); // then PickComment findPickComment = pickCommentRepository.findById(pickComment.getId()).get(); @@ -742,9 +743,10 @@ void modifyPickCommentMemberException() { em.clear(); ModifyPickCommentRequest request = new ModifyPickCommentRequest("주무세웅"); + PickCommentDto modifyCommentDto = PickCommentDto.createModifyCommentDto(request, null); // when // then - assertThatThrownBy(() -> memberPickCommentService.modifyPickComment(0L, 0L, request, + assertThatThrownBy(() -> memberPickCommentService.modifyPickComment(0L, 0L, modifyCommentDto, authentication)) .isInstanceOf(MemberException.class) .hasMessage(INVALID_MEMBER_NOT_FOUND_MESSAGE); @@ -779,9 +781,10 @@ void modifyPickCommentNotFoundPickComment() { em.clear(); ModifyPickCommentRequest request = new ModifyPickCommentRequest("주무세웅"); + PickCommentDto modifyCommentDto = PickCommentDto.createModifyCommentDto(request, null); // when // then - assertThatThrownBy(() -> memberPickCommentService.modifyPickComment(0L, pick.getId(), request, + assertThatThrownBy(() -> memberPickCommentService.modifyPickComment(0L, pick.getId(), modifyCommentDto, authentication)) .isInstanceOf(NotFoundException.class) .hasMessage(INVALID_NOT_FOUND_PICK_COMMENT_MESSAGE); @@ -820,9 +823,10 @@ void modifyPickCommentNotFoundPickCommentOtherMember() { em.clear(); ModifyPickCommentRequest request = new ModifyPickCommentRequest("주무세웅"); + PickCommentDto modifyCommentDto = PickCommentDto.createModifyCommentDto(request, null); // when // then - assertThatThrownBy(() -> memberPickCommentService.modifyPickComment(pickComment.getId(), pick.getId(), request, + assertThatThrownBy(() -> memberPickCommentService.modifyPickComment(pickComment.getId(), pick.getId(), modifyCommentDto, authentication)) .isInstanceOf(NotFoundException.class) .hasMessage(INVALID_NOT_FOUND_PICK_COMMENT_MESSAGE); @@ -862,9 +866,10 @@ void modifyPickCommentNotFoundPickCommentIsDeletedAt() { em.clear(); ModifyPickCommentRequest request = new ModifyPickCommentRequest("주무세웅"); + PickCommentDto modifyCommentDto = PickCommentDto.createModifyCommentDto(request, null); // when // then - assertThatThrownBy(() -> memberPickCommentService.modifyPickComment(pickComment.getId(), pick.getId(), request, + assertThatThrownBy(() -> memberPickCommentService.modifyPickComment(pickComment.getId(), pick.getId(), modifyCommentDto, authentication)) .isInstanceOf(NotFoundException.class) .hasMessage(INVALID_NOT_FOUND_PICK_COMMENT_MESSAGE); @@ -904,9 +909,10 @@ void modifyPickCommentNotApproval(ContentStatus contentStatus) { em.clear(); ModifyPickCommentRequest request = new ModifyPickCommentRequest("주무세웅"); + PickCommentDto modifyCommentDto = PickCommentDto.createModifyCommentDto(request, null); // when // then - assertThatThrownBy(() -> memberPickCommentService.modifyPickComment(pickComment.getId(), pick.getId(), request, + assertThatThrownBy(() -> memberPickCommentService.modifyPickComment(pickComment.getId(), pick.getId(), modifyCommentDto, authentication)) .isInstanceOf(IllegalArgumentException.class) .hasMessage(INVALID_NOT_APPROVAL_STATUS_PICK_COMMENT_MESSAGE, MODIFY); diff --git a/src/test/java/com/dreamypatisiel/devdevdev/domain/service/pick/PickTestUtils.java b/src/test/java/com/dreamypatisiel/devdevdev/domain/service/pick/PickTestUtils.java index 1c6b7599..cadb37a0 100644 --- a/src/test/java/com/dreamypatisiel/devdevdev/domain/service/pick/PickTestUtils.java +++ b/src/test/java/com/dreamypatisiel/devdevdev/domain/service/pick/PickTestUtils.java @@ -156,6 +156,21 @@ public static PickComment createPickComment(CommentContents contents, Boolean is return pickComment; } + public static PickComment createPickComment(CommentContents contents, Boolean isPublic, AnonymousMember anonymousMember, + Pick pick) { + PickComment pickComment = PickComment.builder() + .contents(contents) + .isPublic(isPublic) + .createdAnonymousBy(anonymousMember) + .replyTotalCount(new Count(0)) + .pick(pick) + .build(); + + pickComment.changePick(pick); + + return pickComment; + } + public static Pick createPick(Title title, ContentStatus contentStatus, Member member) { return Pick.builder() .title(title) diff --git a/src/test/java/com/dreamypatisiel/devdevdev/web/docs/PickCommentControllerDocsTest.java b/src/test/java/com/dreamypatisiel/devdevdev/web/docs/PickCommentControllerDocsTest.java index f2f1264a..9bb0ead0 100644 --- a/src/test/java/com/dreamypatisiel/devdevdev/web/docs/PickCommentControllerDocsTest.java +++ b/src/test/java/com/dreamypatisiel/devdevdev/web/docs/PickCommentControllerDocsTest.java @@ -421,7 +421,8 @@ void modifyPickComment() throws Exception { preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()), requestHeaders( - headerWithName(AUTHORIZATION_HEADER).description("Bearer 엑세스 토큰") + headerWithName(AUTHORIZATION_HEADER).optional().description("Bearer 엑세스 토큰"), + headerWithName(HEADER_ANONYMOUS_MEMBER_ID).optional().description("익명회원 아이디") ), pathParameters( parameterWithName("pickId").description("픽픽픽 아이디"), @@ -477,7 +478,8 @@ void modifyPickCommentBindException(String contents) throws Exception { preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint()), requestHeaders( - headerWithName(AUTHORIZATION_HEADER).description("Bearer 엑세스 토큰") + headerWithName(AUTHORIZATION_HEADER).optional().description("Bearer 엑세스 토큰"), + headerWithName(HEADER_ANONYMOUS_MEMBER_ID).optional().description("익명회원 아이디") ), pathParameters( parameterWithName("pickId").description("픽픽픽 아이디"),