Skip to content

Commit 8a9f3ea

Browse files
committed
refactor(community): command controller 수정
- @currentuser -> @RoleId - 명확성을 위해 userId -> volunteerId로 변경
1 parent 422b29c commit 8a9f3ea

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

src/main/java/com/somemore/domains/community/controller/CommunityBoardCommandApiController.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import com.somemore.domains.community.usecase.board.CreateCommunityBoardUseCase;
66
import com.somemore.domains.community.usecase.board.DeleteCommunityBoardUseCase;
77
import com.somemore.domains.community.usecase.board.UpdateCommunityBoardUseCase;
8-
import com.somemore.global.auth.annotation.CurrentUser;
8+
import com.somemore.global.auth.annotation.RoleId;
99
import com.somemore.global.common.response.ApiResponse;
1010
import com.somemore.global.imageupload.dto.ImageUploadRequestDto;
1111
import com.somemore.global.imageupload.usecase.ImageUploadUseCase;
@@ -42,15 +42,15 @@ public class CommunityBoardCommandApiController {
4242
@Operation(summary = "커뮤니티 게시글 등록", description = "커뮤니티 게시글을 등록합니다.")
4343
@PostMapping(consumes = MULTIPART_FORM_DATA_VALUE)
4444
public ApiResponse<Long> createCommunityBoard(
45-
@CurrentUser UUID userId,
45+
@RoleId UUID volunteerId,
4646
@Valid @RequestPart("data") CommunityBoardCreateRequestDto requestDto,
4747
@RequestPart(value = "img_file", required = false) MultipartFile image
4848
) {
4949
String imgUrl = imageUploadUseCase.uploadImage(new ImageUploadRequestDto(image));
5050

5151
return ApiResponse.ok(
5252
201,
53-
createCommunityBoardUseCase.createCommunityBoard(requestDto, userId, imgUrl),
53+
createCommunityBoardUseCase.createCommunityBoard(requestDto, volunteerId, imgUrl),
5454
"커뮤니티 게시글 등록 성공"
5555
);
5656
}
@@ -59,13 +59,13 @@ public ApiResponse<Long> createCommunityBoard(
5959
@Operation(summary = "커뮤니티 게시글 수정", description = "커뮤니티 게시글을 수정합니다.")
6060
@PutMapping(value = "/{id}", consumes = MULTIPART_FORM_DATA_VALUE)
6161
public ApiResponse<String> updateCommunityBoard(
62-
@CurrentUser UUID userId,
62+
@RoleId UUID volunteerId,
6363
@PathVariable Long id,
6464
@Valid @RequestPart("data") CommunityBoardUpdateRequestDto requestDto,
6565
@RequestPart(value = "img_file", required = false) MultipartFile image
6666
) {
6767
String imgUrl = imageUploadUseCase.uploadImage(new ImageUploadRequestDto(image));
68-
updateCommunityBoardUseCase.updateCommunityBoard(requestDto, id, userId, imgUrl);
68+
updateCommunityBoardUseCase.updateCommunityBoard(requestDto, id, volunteerId, imgUrl);
6969

7070
return ApiResponse.ok("커뮤니티 게시글 수정 성공");
7171
}
@@ -74,10 +74,10 @@ public ApiResponse<String> updateCommunityBoard(
7474
@Operation(summary = "커뮤니티 게시글 삭제", description = "커뮤니티 게시글을 삭제합니다.")
7575
@DeleteMapping(value = "/{id}")
7676
public ApiResponse<String> deleteCommunityBoard(
77-
@CurrentUser UUID userId,
77+
@RoleId UUID volunteerId,
7878
@PathVariable Long id
7979
) {
80-
deleteCommunityBoardUseCase.deleteCommunityBoard(userId, id);
80+
deleteCommunityBoardUseCase.deleteCommunityBoard(volunteerId, id);
8181

8282
return ApiResponse.ok("커뮤니티 게시글 삭제 성공");
8383
}

src/main/java/com/somemore/domains/community/controller/CommunityCommentCommandApiController.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import com.somemore.domains.community.usecase.comment.CreateCommunityCommentUseCase;
66
import com.somemore.domains.community.usecase.comment.DeleteCommunityCommentUseCase;
77
import com.somemore.domains.community.usecase.comment.UpdateCommunityCommentUseCase;
8-
import com.somemore.global.auth.annotation.CurrentUser;
8+
import com.somemore.global.auth.annotation.RoleId;
99
import com.somemore.global.common.response.ApiResponse;
1010
import io.swagger.v3.oas.annotations.Operation;
1111
import io.swagger.v3.oas.annotations.tags.Tag;
@@ -36,26 +36,26 @@ public class CommunityCommentCommandApiController {
3636
@Operation(summary = "커뮤니티 댓글 등록", description = "커뮤니티 게시글에 댓글을 등록합니다.")
3737
@PostMapping(value = "/comment")
3838
public ApiResponse<Long> createCommunityComment(
39-
@CurrentUser UUID userId,
39+
@RoleId UUID volunteerId,
4040
@PathVariable Long boardId,
4141
@Valid @RequestBody CommunityCommentCreateRequestDto requestDto) {
4242

4343
return ApiResponse.ok(
4444
201,
45-
createCommunityCommentUseCase.createCommunityComment(requestDto, userId, boardId),
45+
createCommunityCommentUseCase.createCommunityComment(requestDto, volunteerId, boardId),
4646
"커뮤니티 댓글 등록 성공");
4747
}
4848

4949
@Secured("ROLE_VOLUNTEER")
5050
@Operation(summary = "커뮤니티 댓글 수정", description = "커뮤니티 댓글을 수정합니다.")
5151
@PutMapping(value = "/comment/{id}")
5252
public ApiResponse<String> updateCommunityComment(
53-
@CurrentUser UUID userId,
53+
@RoleId UUID volunteerId,
5454
@PathVariable Long boardId,
5555
@PathVariable Long id,
5656
@Valid @RequestBody CommunityCommentUpdateRequestDto requestDto
5757
) {
58-
updateCommunityCommentUseCase.updateCommunityComment(requestDto, id, userId, boardId);
58+
updateCommunityCommentUseCase.updateCommunityComment(requestDto, id, volunteerId, boardId);
5959

6060
return ApiResponse.ok("커뮤니티 댓글 수정 성공");
6161
}
@@ -64,11 +64,11 @@ public ApiResponse<String> updateCommunityComment(
6464
@Operation(summary = "커뮤니티 댓글 삭제", description = "커뮤니티 댓글을 삭제합니다.")
6565
@DeleteMapping(value = "/comment/{id}")
6666
public ApiResponse<String> deleteCommunityComment(
67-
@CurrentUser UUID userId,
67+
@RoleId UUID volunteerId,
6868
@PathVariable Long boardId,
6969
@PathVariable Long id
7070
) {
71-
deleteCommunityCommentUseCase.deleteCommunityComment(userId, id, boardId);
71+
deleteCommunityCommentUseCase.deleteCommunityComment(volunteerId, id, boardId);
7272

7373
return ApiResponse.ok("커뮤니티 댓글 삭제 성공");
7474
}

0 commit comments

Comments
 (0)