diff --git a/src/main/java/com/example/sharemind/comment/presentation/CommentController.java b/src/main/java/com/example/sharemind/comment/presentation/CommentController.java index 2e9f141c..b2fd9d33 100644 --- a/src/main/java/com/example/sharemind/comment/presentation/CommentController.java +++ b/src/main/java/com/example/sharemind/comment/presentation/CommentController.java @@ -41,12 +41,13 @@ public class CommentController { ) }) @Parameters({ - @Parameter(name = "postId", description = "일대다 상담 ID") + @Parameter(name = "postUuid", description = "일대다 상담 ID") }) - @GetMapping("/counselors/{postId}") - public ResponseEntity> getCounselorComments(@PathVariable UUID postId, - @AuthenticationPrincipal CustomUserDetails customUserDetails) { - return ResponseEntity.ok(commentService.getCounselorComments(postId, + @GetMapping("/counselors/{postUuid}") + public ResponseEntity> getCounselorComments( + @PathVariable UUID postUuid, + @AuthenticationPrincipal CustomUserDetails customUserDetails) { + return ResponseEntity.ok(commentService.getCounselorComments(postUuid, customUserDetails.getCustomer().getCustomerId())); } @@ -55,8 +56,9 @@ public ResponseEntity> getCounselorComments(@PathVariab - 주소 형식: /api/v1/comments/counselors""") @ApiResponses({ @ApiResponse(responseCode = "201", description = "댓글 생성 성공"), - @ApiResponse(responseCode = "400", description = "1. 진행중이지 않은 상담\n 2. 마감된 상담 중 상담사 본인이 답변을 작성하지 않은 상담" + - "3. 이미 답변을 작성한 상담 4. 자기자신에게 댓글 작성한 상담", + @ApiResponse(responseCode = "400", description = + "1. 진행중이지 않은 상담\n 2. 마감된 상담 중 상담사 본인이 답변을 작성하지 않은 상담" + + "3. 이미 답변을 작성한 상담 4. 자기자신에게 댓글 작성한 상담", content = @Content(mediaType = "application/json", schema = @Schema(implementation = CustomExceptionResponse.class)) ) @@ -81,12 +83,12 @@ public ResponseEntity createComments( ) }) @Parameters({ - @Parameter(name = "postId", description = "일대다 상담 ID") + @Parameter(name = "postUuid", description = "일대다 상담 ID") }) - @GetMapping("/customers/{postId}") - public ResponseEntity> getCustomerComments(@PathVariable UUID postId, - @AuthenticationPrincipal CustomUserDetails customUserDetails) { - return ResponseEntity.ok(commentService.getCustomerComments(postId, + @GetMapping("/customers/{postUuid}") + public ResponseEntity> getCustomerComments(@PathVariable UUID postUuid, + @AuthenticationPrincipal CustomUserDetails customUserDetails) { + return ResponseEntity.ok(commentService.getCustomerComments(postUuid, customUserDetails == null ? 0 : customUserDetails.getCustomer().getCustomerId())); } @@ -102,20 +104,23 @@ public ResponseEntity> getCustomerComments(@PathVariabl content = @Content(mediaType = "application/json", schema = @Schema(implementation = CustomExceptionResponse.class)) ), - @ApiResponse(responseCode = "404", description = "1. 존재하지 않는 사용자일 때 2. 존재하지 않는 일대다 상담 ID 일 때 " - + "3. 존재하지 않는 답변 ID 일 때 4. 해당 게시물에 달린 답변이 아닐 때", + @ApiResponse(responseCode = "404", description = + "1. 존재하지 않는 사용자일 때 2. 존재하지 않는 일대다 상담 ID 일 때 " + + "3. 존재하지 않는 답변 ID 일 때 4. 해당 게시물에 달린 답변이 아닐 때", content = @Content(mediaType = "application/json", schema = @Schema(implementation = CustomExceptionResponse.class)) ) }) @Parameters({ - @Parameter(name = "postId", description = "일대다 상담 ID"), + @Parameter(name = "postUuid", description = "일대다 상담 ID"), @Parameter(name = "commentId", description = "답변 ID") }) - @PatchMapping("/customers/{postId}") - public ResponseEntity updateCustomerChosenComment(@PathVariable UUID postId, @RequestParam Long commentId, - @AuthenticationPrincipal CustomUserDetails customUserDetails) { - commentService.updateCustomerChosenComment(postId, commentId, customUserDetails.getCustomer().getCustomerId()); + @PatchMapping("/customers/{postUuid}") + public ResponseEntity updateCustomerChosenComment(@PathVariable UUID postUuid, + @RequestParam Long commentId, + @AuthenticationPrincipal CustomUserDetails customUserDetails) { + commentService.updateCustomerChosenComment(postUuid, commentId, + customUserDetails.getCustomer().getCustomerId()); return ResponseEntity.ok().build(); } @@ -129,11 +134,12 @@ public ResponseEntity updateCustomerChosenComment(@PathVariable UUID postI ) }) @Parameters({ - @Parameter(name = "postId", description = "일대다 상담 ID"), + @Parameter(name = "postUuid", description = "일대다 상담 ID"), }) - @GetMapping("/counselors/authentication/{postId}") - public Boolean getIsCommentOwner(@PathVariable UUID postId, - @AuthenticationPrincipal CustomUserDetails customUserDetails) { - return commentService.getIsCommentOwner(postId, customUserDetails.getCustomer().getCustomerId()); + @GetMapping("/counselors/authentication/{postUuid}") + public Boolean getIsCommentOwner(@PathVariable UUID postUuid, + @AuthenticationPrincipal CustomUserDetails customUserDetails) { + return commentService.getIsCommentOwner(postUuid, + customUserDetails.getCustomer().getCustomerId()); } } diff --git a/src/main/java/com/example/sharemind/post/presentation/PostController.java b/src/main/java/com/example/sharemind/post/presentation/PostController.java index 2c8c2a3d..ca28f6ac 100644 --- a/src/main/java/com/example/sharemind/post/presentation/PostController.java +++ b/src/main/java/com/example/sharemind/post/presentation/PostController.java @@ -93,12 +93,12 @@ public ResponseEntity updatePost(@Valid @RequestBody PostUpdateRequest pos ) }) @Parameters({ - @Parameter(name = "postId", description = "일대다 질문 아이디") + @Parameter(name = "postUuid", description = "일대다 질문 아이디") }) - @GetMapping("/{postId}") - public ResponseEntity getPost(@PathVariable UUID postId, + @GetMapping("/{postUuid}") + public ResponseEntity getPost(@PathVariable UUID postUuid, @AuthenticationPrincipal CustomUserDetails customUserDetails) { - return ResponseEntity.ok(postService.getPost(postId, + return ResponseEntity.ok(postService.getPost(postUuid, customUserDetails == null ? 0 : customUserDetails.getCustomer().getCustomerId())); } @@ -114,54 +114,54 @@ public ResponseEntity getPost(@PathVariable UUID postId, }) @Parameters({ @Parameter(name = "filter", description = "완료/취소된 상담 제외: true, 포함: false"), - @Parameter(name = "postId", description = """ - - 조회 결과는 4개씩 반환하며, postId로 구분 - 1. 최초 조회 요청이면 postId는 00000000-0000-0000-0000-000000000000 - 2. 2번째 요청부터 postId는 직전 요청의 조회 결과 4개 중 마지막 postId""") + @Parameter(name = "postUuid", description = """ + - 조회 결과는 4개씩 반환하며, postUuid로 구분 + 1. 최초 조회 요청이면 postUuid는 00000000-0000-0000-0000-000000000000 + 2. 2번째 요청부터 postUuid는 직전 요청의 조회 결과 4개 중 마지막 postUuid""") }) @GetMapping("/customers") public ResponseEntity> getPostsByCustomer( @RequestParam Boolean filter, - @RequestParam UUID postId, + @RequestParam UUID postUuid, @AuthenticationPrincipal CustomUserDetails customUserDetails) { - return ResponseEntity.ok(postService.getPostsByCustomer(filter, postId, + return ResponseEntity.ok(postService.getPostsByCustomer(filter, postUuid, customUserDetails.getCustomer().getCustomerId())); } @Operation(summary = "상담사 본인 일대다 상담 리스트 조회", description = """ - 상담사 상담 탭에서 본인이 댓글 작성한 일대다 상담 질문 리스트 조회 - - 주소 형식: /api/v1/posts/counselors?filter=true&postId=0""") + - 주소 형식: /api/v1/posts/counselors?filter=true&postUuid=0""") @ApiResponses({ @ApiResponse(responseCode = "200", description = "조회 성공") }) @Parameters({ @Parameter(name = "filter", description = "완료/취소된 상담 제외: true, 포함: false"), - @Parameter(name = "postId", description = """ - - 조회 결과는 4개씩 반환하며, postId로 구분 - 1. 최초 조회 요청이면 postId는 00000000-0000-0000-0000-000000000000 - 2. 2번째 요청부터 postId는 직전 요청의 조회 결과 4개 중 마지막 postId""") + @Parameter(name = "postUuid", description = """ + - 조회 결과는 4개씩 반환하며, postUuid로 구분 + 1. 최초 조회 요청이면 postUuid는 00000000-0000-0000-0000-000000000000 + 2. 2번째 요청부터 postUuid는 직전 요청의 조회 결과 4개 중 마지막 postId""") }) @GetMapping("/counselors") public ResponseEntity> getPostsByCounselor( @RequestParam Boolean filter, - @RequestParam UUID postId, + @RequestParam UUID postUuid, @AuthenticationPrincipal CustomUserDetails customUserDetails) { - return ResponseEntity.ok(postService.getPostsByCounselor(filter, postId, + return ResponseEntity.ok(postService.getPostsByCounselor(filter, postUuid, customUserDetails.getCustomer().getCustomerId())); } @Operation(summary = "구매자 사이드 공개상담 탭 일대다 상담 리스트 기본순 조회", description = """ - 구매자 사이드의 공개상담 탭에서 답변 완료된 일대다 상담 질문 리스트 기본순 조회 - 로그인한 사용자일 경우 헤더에 accessToken을 넣어주세요 - - 주소 형식: /api/v1/posts/customers/public?postId=0&finishedAt=2024-03-22T00:47:59""") + - 주소 형식: /api/v1/posts/customers/public?postUuid=0&finishedAt=2024-03-22T00:47:59""") @ApiResponses({ @ApiResponse(responseCode = "200", description = "조회 성공") }) @Parameters({ - @Parameter(name = "postId", description = """ - - 조회 결과는 4개씩 반환하며, postId와 finishedAt으로 구분 - 1. 최초 조회 요청이면 postId는 00000000-0000-0000-0000-000000000000 - 2. 2번째 요청부터 postId는 직전 요청의 조회 결과 4개 중 마지막 postId"""), + @Parameter(name = "postUuid", description = """ + - 조회 결과는 4개씩 반환하며, postUuid와 finishedAt으로 구분 + 1. 최초 조회 요청이면 postUuid는 00000000-0000-0000-0000-000000000000 + 2. 2번째 요청부터 postUuid는 직전 요청의 조회 결과 4개 중 마지막 postId"""), @Parameter(name = "finishedAt", description = """ 1. 최초 조회 요청이면 지금 시간 2. 2번째 요청부터 finishedAt은 직전 요청의 조회 결과 4개 중 마지막 finishedAt @@ -169,10 +169,10 @@ public ResponseEntity> getPostsByCounselor( }) @GetMapping("/customers/public") public ResponseEntity> getPublicPostsByCustomer( - @RequestParam UUID postId, + @RequestParam UUID postUuid, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss") LocalDateTime finishedAt, @AuthenticationPrincipal CustomUserDetails customUserDetails) { - return ResponseEntity.ok(postService.getPublicPostsByCustomer(postId, finishedAt, + return ResponseEntity.ok(postService.getPublicPostsByCustomer(postUuid, finishedAt, customUserDetails == null ? 0 : customUserDetails.getCustomer().getCustomerId())); } @@ -184,10 +184,10 @@ public ResponseEntity> getPublicPostsByCustomer( @ApiResponse(responseCode = "200", description = "조회 성공") }) @Parameters({ - @Parameter(name = "postId", description = """ - - 조회 결과는 4개씩 반환하며, postId와 finishedAt으로 구분 - 1. 최초 조회 요청이면 postId는 00000000-0000-0000-0000-000000000000 - 2. 2번째 요청부터 postId는 직전 요청의 조회 결과 4개 중 마지막 postId"""), + @Parameter(name = "postUuid", description = """ + - 조회 결과는 4개씩 반환하며, postUuid와 finishedAt으로 구분 + 1. 최초 조회 요청이면 postUuid는 00000000-0000-0000-0000-000000000000 + 2. 2번째 요청부터 postUuid는 직전 요청의 조회 결과 4개 중 마지막 postUuid"""), @Parameter(name = "finishedAt", description = """ 1. 최초 조회 요청이면 지금 시간 2. 2번째 요청부터 finishedAt은 직전 요청의 조회 결과 4개 중 마지막 finishedAt @@ -195,10 +195,10 @@ public ResponseEntity> getPublicPostsByCustomer( }) @GetMapping("/customers/public/likes") public ResponseEntity> getPopularityPosts( - @RequestParam UUID postId, + @RequestParam UUID postUuid, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss") LocalDateTime finishedAt, @AuthenticationPrincipal CustomUserDetails customUserDetails) { - return ResponseEntity.ok(postService.getPopularityPosts(postId, finishedAt, + return ResponseEntity.ok(postService.getPopularityPosts(postUuid, finishedAt, customUserDetails == null ? 0 : customUserDetails.getCustomer().getCustomerId())); } @@ -225,13 +225,12 @@ public ResponseEntity> getRandomPosts() { ) }) @Parameters({ - @Parameter(name = "postId", description = """ - - 일대다 상담 ID""") + @Parameter(name = "postUuid", description = "일대다 상담 ID") }) - @GetMapping("/counselors/{postId}") - public ResponseEntity getPostInfo(@PathVariable UUID postId, + @GetMapping("/counselors/{postUuid}") + public ResponseEntity getPostInfo(@PathVariable UUID postUuid, @AuthenticationPrincipal CustomUserDetails customUserDetails) { - return ResponseEntity.ok(postService.getCounselorPostContent(postId, + return ResponseEntity.ok(postService.getCounselorPostContent(postUuid, customUserDetails.getCustomer().getCustomerId())); } @@ -245,12 +244,12 @@ public ResponseEntity getPostInfo(@PathVariable UUID postId, ) }) @Parameters({ - @Parameter(name = "postId", description = "일대다 질문 아이디") + @Parameter(name = "postUuid", description = "일대다 질문 아이디") }) - @GetMapping("/customers/public/{postId}") - public Boolean getIsPostOwner(@PathVariable UUID postId, + @GetMapping("/customers/public/{postUuid}") + public Boolean getIsPostOwner(@PathVariable UUID postUuid, @AuthenticationPrincipal CustomUserDetails customUserDetails) { - return postService.getIsPostOwner(postId, + return postService.getIsPostOwner(postUuid, customUserDetails == null ? 0 : customUserDetails.getCustomer().getCustomerId()); } }