Skip to content

Commit

Permalink
#520 [feat] 글감 삭제 인가체제 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
parkheeddong committed Oct 6, 2024
1 parent 76def44 commit 37aa76a
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ public ResponseEntity<SuccessResponse<TopicDetailResponse>> getTopicDetail(

@Override
@DeleteMapping("/{topicId}")
@UserAuthAnnotation(UserAuthenticationType.OWNER)
public ResponseEntity<SuccessResponse> deleteTopic(
@TopicIdPathVariable final Long topicId,
@UserId final Long userId,
@PathVariable("topicId") final String topicUrl
) {
topicService.deleteTopic(userId, topicId);
topicService.deleteTopic(topicId);
return ResponseEntity.ok(SuccessResponse.of(SuccessMessage.TOPIC_DELETE_SUCCESS));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ ResponseEntity<SuccessResponse<TopicDetailResponse>> getTopicDetail(
)
ResponseEntity<SuccessResponse> deleteTopic(
@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
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,9 @@ public TopicDetailResponse getTopicDetail(

@Transactional
public void deleteTopic(
final Long userId,
final Long topicId
) {
Topic topic = topicRetriever.findById(topicId);
User user = userService.findById(userId);
topicRetriever.authenticateTopicWithUser(topic, user);
topicRetriever.checkSingleTopicDeletion(topic);
topicRemover.deleteTopic(topic);
}
Expand Down

0 comments on commit 37aa76a

Please sign in to comment.