Skip to content

Commit ac7d856

Browse files
authored
Refactor: 엔드포인트 수정 (#113)
## #️⃣연관된 이슈 > ex) #이슈번호, #이슈번호 ## 📝작업 내용 > 이번 PR에서 작업한 내용을 간략히 설명해주세요(이미지 첨부 가능) ### 스크린샷 (선택) ## 💬리뷰 요구사항(선택) > 리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요 > > ex) 메서드 XXX의 이름을 더 잘 짓고 싶은데 혹시 좋은 명칭이 있을까요?
2 parents e8f47e4 + 8df657e commit ac7d856

File tree

6 files changed

+19
-18
lines changed

6 files changed

+19
-18
lines changed

src/main/java/EatPic/spring/domain/bookmark/controller/BookmarkController.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,24 @@
1616

1717
@RestController
1818
@RequiredArgsConstructor
19-
@RequestMapping("/api/community")
20-
@Tag(name = "Bookmark", description = "반응 관련 API")
19+
@RequestMapping("/api/bookmarks")
20+
@Tag(name = "Bookmark", description = "카드 저장 관련 API")
2121
public class BookmarkController {
2222

2323
private final BookmarkService bookmarkService;
2424

2525
@Operation(
2626
summary = "카드 저장",
2727
description = "해당 카드를 저장합니다.")
28-
@PostMapping("/cards/{cardId}/bookmark")
28+
@PostMapping("/{cardId}")
2929
public ApiResponse<BookmarkResponseDTO.BookmarkResponseDto> saveBookmark(@PathVariable("cardId") Long cardId) {
3030
return ApiResponse.onSuccess(bookmarkService.saveBookmark(cardId));
3131
}
3232

3333
@Operation(
3434
summary = "카드 저장 취소",
3535
description = "해당 카드의 저장을 취소합니다.")
36-
@DeleteMapping("/cards/{cardId}/bookmark")
36+
@DeleteMapping("/{cardId}")
3737
public ApiResponse<BookmarkResponseDTO.BookmarkResponseDto> deleteBookmark(@PathVariable("cardId") Long cardId) {
3838
return ApiResponse.onSuccess(bookmarkService.deleteBookmark(cardId));
3939
}

src/main/java/EatPic/spring/domain/card/controller/CardController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public ResponseEntity<ApiResponse<CardDetailResponse>> updateCard(
128128
@Operation(
129129
summary = "피드 조회",
130130
description = "특정 사용자(null이면 전체 사용자)의 최근 7일 동안의 피드를 조회합니다.(전체, 본인의 경우 전체 피드를 조회합니다)")
131-
@GetMapping("/community/feeds")
131+
@GetMapping("/feeds")
132132
public ApiResponse<CardResponse.PagedCardFeedResponseDto> getFeeds(@RequestParam(required = false) Long userId,
133133
@RequestParam(required = false) Long cursor,
134134
@RequestParam(defaultValue = "15") int size) {

src/main/java/EatPic/spring/domain/comment/controller/CommentRestController.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616
@Validated
1717
@RestController
1818
@RequiredArgsConstructor
19-
@RequestMapping("/api/community")
19+
@RequestMapping("/api/comments")
2020
@Tag(name = "Comment", description = "댓글 관련 API")
2121
public class CommentRestController {
2222
private final CommentService commentService;
2323

2424
@Operation(
2525
summary = "카드 댓글 작성",
2626
description = "parent_comment_id가 null이면 댓글, non-null이면 답글 입니다.")
27-
@PostMapping("/cards/{cardId}/comments")
27+
@PostMapping("/{cardId}")
2828
public ApiResponse<CommentResponseDTO.WriteCommentResponseDTO> writeComment(@PathVariable("cardId") Long cardId,
2929
@Valid @RequestBody CommentRequestDTO.WriteCommentDto requestDto) {
3030
Comment comment = commentService.writeComment(requestDto,cardId);
@@ -35,7 +35,7 @@ public ApiResponse<CommentResponseDTO.WriteCommentResponseDTO> writeComment(@Pat
3535
@Operation(
3636
summary = "카드 댓글 조회",
3737
description = "hasNext가 null이면 마지막 페이지 입니다.")
38-
@GetMapping("/cards/{cardId}/comments")
38+
@GetMapping("/{cardId}")
3939
public ApiResponse<CommentResponseDTO.commentListDTO> getComment(@PathVariable("cardId") Long cardId,
4040
@RequestParam(required = false) Long cursor,
4141
@RequestParam(defaultValue = "15") int size) {
@@ -46,7 +46,7 @@ public ApiResponse<CommentResponseDTO.commentListDTO> getComment(@PathVariable("
4646
@Operation(
4747
summary = "답글 조회",
4848
description = "해당 댓글의 답글을 조회합니다. hasNext가 null이면 마지막 페이지 입니다.")
49-
@GetMapping("/cards/{cardId}/comments/{commentId}/replies")
49+
@GetMapping("/{cardId}/replies/{commentId}")
5050
public ApiResponse<CommentResponseDTO.commentListDTO> getReplies(@PathVariable("commentId") Long commentId,
5151
@RequestParam(required = false) Long cursor,
5252
@RequestParam(defaultValue = "15") int size) {
@@ -57,7 +57,7 @@ public ApiResponse<CommentResponseDTO.commentListDTO> getReplies(@PathVariable("
5757
@Operation(
5858
summary = "카드 댓글 삭제",
5959
description = "댓글이면 답글까지 전체 삭제, 답글이면 해당 답글만 삭제합니다.")
60-
@DeleteMapping("/cards/{cardId}/comments/{commentId}")
60+
@DeleteMapping("/{commentId}")
6161
public ApiResponse<CommentResponseDTO.DeleteCommentResponseDTO> deleteComment(@PathVariable("cardId") Long cardId,
6262
@PathVariable("commentId") Long commentId) {
6363

src/main/java/EatPic/spring/domain/reaction/controller/ReactionRestController.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
@RestController
1616
@RequiredArgsConstructor
17-
@RequestMapping("/api/community")
17+
@RequestMapping("/api/reactions")
1818
@Tag(name = "Reaction", description = "반응 관련 API")
1919
public class ReactionRestController {
2020

@@ -23,7 +23,7 @@ public class ReactionRestController {
2323
@Operation(
2424
summary = "카드 반응 작성/수정/삭제",
2525
description = "카드에 반응을 작성합니다. 기존에 작성한 반응이 존재하고 같은 반응을 요청하면 해당 반응이 삭제됩니다")
26-
@PostMapping("/cards/{cardId}/reactions/{reactionType}")
26+
@PostMapping("/{cardId}/{reactionType}")
2727
public ApiResponse<ReactionResponseDTO.ReactionHandleResponseDto> handleReaction(@PathVariable("cardId") Long cardId,
2828
@PathVariable("reactionType") ReactionType reactionType) {
2929
return ApiResponse.onSuccess(reactionService.handleReaction(cardId,reactionType));
@@ -32,7 +32,7 @@ public ApiResponse<ReactionResponseDTO.ReactionHandleResponseDto> handleReaction
3232
@Operation(
3333
summary = "해당 카드에 작성된 반응 별 유저정보",
3434
description = "reactionType에 따라 반응을 작성한 유저 리스트를 반환합니다")
35-
@GetMapping("/cards/{cardId}/reactions-users")
35+
@GetMapping("/{cardId}/users")
3636
public ApiResponse<ReactionResponseDTO.CardReactionUserListDto> CardReactionUsersList(@PathVariable("cardId") Long cardId,
3737
@RequestParam("reactionType") ReactionType reactionType,
3838
@RequestParam(defaultValue = "1") int page,

src/main/java/EatPic/spring/domain/reportHistory/controller/ReportController.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515

1616
@RestController
1717
@RequiredArgsConstructor
18-
@RequestMapping("/api/report")
18+
19+
@RequestMapping("/api/reports")
1920
@Tag(name = "ReportHistory", description = "신고 관련 API")
2021
public class ReportController {
2122

@@ -24,7 +25,7 @@ public class ReportController {
2425
@Operation(
2526
summary = "신고하기",
2627
description = ReportType.SWAGGER_DESCRIPTION)
27-
@PostMapping("")
28+
@PostMapping
2829
public ApiResponse<ReportResponseDTO.ReportResultResponseDTO> createReport(@RequestParam("id")Long id,
2930
@RequestParam TargetType targetType,
3031
@RequestParam ReportType reportType){

src/main/java/EatPic/spring/domain/user/controller/UserRestController.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010

1111
@RestController
1212
@RequiredArgsConstructor
13-
@RequestMapping("/api")
13+
@RequestMapping("/api/users")
1414
public class UserRestController {
1515
private final UserService userService;
1616

1717
@Operation(
1818
summary = "커뮤니티 상단 팔로잉 유저 아이콘",
1919
description = "페이지는 1부터 시작하며 total은 전체 항목 수 입니다.")
20-
@GetMapping("/users")
20+
@GetMapping("/icons/following")
2121
@Tag(name = "User", description = "사용자 관련 API")
2222
public ApiResponse<UserResponseDTO.UserIconListResponseDto> followingUsers(
2323
@RequestParam(defaultValue = "1") int page,
@@ -28,7 +28,7 @@ public ApiResponse<UserResponseDTO.UserIconListResponseDto> followingUsers(
2828

2929
@Operation(
3030
summary = "커뮤니티 상단 팔로잉 유저 아이콘(나)")
31-
@GetMapping("/me")
31+
@GetMapping("/icons/me")
3232
@Tag(name = "User", description = "사용자 관련 API")
3333
public ApiResponse<UserResponseDTO.ProfileDto> myIcon() {
3434
return ApiResponse.onSuccess(userService.getMyIcon());

0 commit comments

Comments
 (0)