From 0ea0caf7e978934f70dbd1ad5ae9b808623aea98 Mon Sep 17 00:00:00 2001 From: parkheeddong Date: Sun, 6 Oct 2024 15:42:40 +0900 Subject: [PATCH] =?UTF-8?q?#520=20[feat]=20=EA=B4=80=EB=A6=AC=EC=9E=90?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=20=EA=B8=80=EA=B0=90=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20=EC=9D=B8=EA=B0=80=EC=B2=B4=EC=A0=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/mile/controller/topic/TopicController.java | 7 +++++-- .../com/mile/controller/topic/TopicControllerSwagger.java | 1 - .../src/main/java/com/mile/moim/service/MoimService.java | 1 + .../src/main/java/com/mile/topic/service/TopicService.java | 3 +-- .../src/main/java/com/mile/topic/service/TopicUpdator.java | 3 --- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/module-api/src/main/java/com/mile/controller/topic/TopicController.java b/module-api/src/main/java/com/mile/controller/topic/TopicController.java index 7db4a404..150ee0dd 100644 --- a/module-api/src/main/java/com/mile/controller/topic/TopicController.java +++ b/module-api/src/main/java/com/mile/controller/topic/TopicController.java @@ -1,5 +1,7 @@ package com.mile.controller.topic; +import com.mile.common.auth.annotation.UserAuthAnnotation; +import com.mile.common.auth.annotation.UserAuthenticationType; import com.mile.common.resolver.user.UserId; import com.mile.dto.SuccessResponse; import com.mile.exception.message.SuccessMessage; @@ -59,13 +61,14 @@ public ResponseEntity deleteTopic( } @PutMapping("/{topicId}") + @UserAuthAnnotation(UserAuthenticationType.OWNER) public ResponseEntity putTopic( @RequestBody @Valid final TopicPutRequest topicPutRequest, @TopicIdPathVariable final Long topicId, - @UserId final Long userId, @PathVariable("topicId") final String topicUrl ) { - topicService.putTopic(userId, topicId, topicPutRequest); + topicService.putTopic(topicId, topicPutRequest); return ResponseEntity.ok(SuccessResponse.of(SuccessMessage.TOPIC_PUT_SUCCESS)); } + } diff --git a/module-api/src/main/java/com/mile/controller/topic/TopicControllerSwagger.java b/module-api/src/main/java/com/mile/controller/topic/TopicControllerSwagger.java index e76194c1..e20aa4ee 100644 --- a/module-api/src/main/java/com/mile/controller/topic/TopicControllerSwagger.java +++ b/module-api/src/main/java/com/mile/controller/topic/TopicControllerSwagger.java @@ -95,7 +95,6 @@ ResponseEntity deleteTopic( ResponseEntity putTopic( @RequestBody final TopicPutRequest topicPutRequest, @Parameter(schema = @Schema(implementation = String.class), in = ParameterIn.PATH) final Long topicId, - @Parameter(schema = @Schema(implementation = String.class), in = ParameterIn.PATH) @UserId final Long userId, @PathVariable("topicId") final String topicUrl ); } diff --git a/module-domain/src/main/java/com/mile/moim/service/MoimService.java b/module-domain/src/main/java/com/mile/moim/service/MoimService.java index e82c9b68..95ba6434 100644 --- a/module-domain/src/main/java/com/mile/moim/service/MoimService.java +++ b/module-domain/src/main/java/com/mile/moim/service/MoimService.java @@ -90,6 +90,7 @@ public WriterNameInformationResponse getWriterNameOfUser( return writerNameRetriever.findWriterNameInfo(writerNameId); } + public WriterNameConflictCheckResponse checkConflictOfWriterName(Long moimId, String writerName) { if (writerName.length() > WRITER_NAME_MAX_VALUE) { throw new BadRequestException(ErrorMessage.WRITER_NAME_LENGTH_WRONG); diff --git a/module-domain/src/main/java/com/mile/topic/service/TopicService.java b/module-domain/src/main/java/com/mile/topic/service/TopicService.java index c34bee67..a30a4a2f 100644 --- a/module-domain/src/main/java/com/mile/topic/service/TopicService.java +++ b/module-domain/src/main/java/com/mile/topic/service/TopicService.java @@ -57,11 +57,10 @@ public void deleteTopic( } public void putTopic( - final Long userId, final Long topicId, final TopicPutRequest topicPutRequest ) { - topicUpdator.putTopic(userId, topicId, topicPutRequest); + topicUpdator.putTopic(topicId, topicPutRequest); } } diff --git a/module-domain/src/main/java/com/mile/topic/service/TopicUpdator.java b/module-domain/src/main/java/com/mile/topic/service/TopicUpdator.java index 811ca528..4287883c 100644 --- a/module-domain/src/main/java/com/mile/topic/service/TopicUpdator.java +++ b/module-domain/src/main/java/com/mile/topic/service/TopicUpdator.java @@ -18,13 +18,10 @@ public class TopicUpdator { @Transactional public void putTopic( - final Long userId, final Long topicId, final TopicPutRequest topicPutRequest ) { Topic topic = topicRetriever.findById(topicId); - User user = userService.findById(userId); - topicRetriever.authenticateTopicWithUser(topic, user); topic.updateTopic(topicPutRequest); }