Skip to content

Commit

Permalink
REFACTOR(main) :: ResponseEntity 삭제
Browse files Browse the repository at this point in the history
  • Loading branch information
Woongbin06 committed Nov 19, 2024
1 parent b6c8686 commit d2b6c7b
Show file tree
Hide file tree
Showing 11 changed files with 172 additions and 93 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import java.util.List;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
Expand Down Expand Up @@ -62,13 +61,13 @@ public void rejectApplication(@PathVariable Long id) {

@GetMapping("/project/{id}")
@Operation(summary = "프로젝트에 신청한 모든 유저 조회")
public ResponseEntity<List<ApplicationResponse>> findProjectApplication(@PathVariable Long id) {
return ResponseEntity.ok(findProjectApplicationService.execute(id));
public List<ApplicationResponse> findProjectApplication(@PathVariable Long id) {
return findProjectApplicationService.execute(id);
}

@GetMapping("/{id}")
@Operation(summary = "신청 하나 조회")
public ResponseEntity<ApplicationResponse> findOneApplication(@PathVariable Long id) {
return ResponseEntity.ok(findApplicationService.execute(id));
public ApplicationResponse findOneApplication(@PathVariable Long id) {
return findApplicationService.execute(id);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public class ChatController {

@MessageMapping("/{roomId}")
@SendTo("/room/{roomId}")
@ResponseStatus(HttpStatus.CREATED)
public void send(@DestinationVariable Long roomId, ChatRequest request) {
commandChatService.create(roomId, request);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public class ChatRoomController {
private final QueryChatRoomService queryChatRoomService;

@PostMapping
@ResponseStatus(HttpStatus.CREATED)
public void create(@RequestBody ChatRoomRequest request) {
commandChatRoomService.create(request);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
package com.woongeya.zoing.domain.comment.presetation;

import java.util.List;

import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.woongeya.zoing.domain.comment.presetation.dto.request.CreateCommentRequest;
import com.woongeya.zoing.domain.comment.presetation.dto.response.CommentResponse;
import com.woongeya.zoing.domain.comment.service.command.CreateCommentService;
import com.woongeya.zoing.domain.comment.service.command.DeleteCommentService;
import com.woongeya.zoing.domain.comment.service.command.UpdateCommentService;
import com.woongeya.zoing.domain.comment.service.query.QueryCommentListService;

import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequiredArgsConstructor
Expand All @@ -25,28 +33,25 @@ public class CommentController {

@PostMapping("/{id}")
@Operation(summary = "댓글 생성")
public ResponseEntity<Void> create(@PathVariable Long id, @RequestBody CreateCommentRequest request) {
public void create(@PathVariable Long id, @RequestBody CreateCommentRequest request) {
createCommentService.execute(id, request);
return ResponseEntity.noContent().build();
}

@GetMapping("/{id}")
@Operation(summary = "댓글 조회")
public ResponseEntity<List<CommentResponse>> getAll(@PathVariable Long id) {
return ResponseEntity.ok(queryCommentListService.execute(id));
public List<CommentResponse> getAll(@PathVariable Long id) {
return queryCommentListService.execute(id);
}

@PutMapping("/{id}")
@Operation(summary = "댓글 수정")
public ResponseEntity<Void> update(@PathVariable Long id, @RequestBody CreateCommentRequest request) {
public void update(@PathVariable Long id, @RequestBody CreateCommentRequest request) {
updateCommentService.execute(id, request);
return ResponseEntity.noContent().build();
}

@DeleteMapping("/{id}")
@Operation(summary = "댓글 삭제")
public ResponseEntity<Void> delete(@PathVariable Long id) {
public void delete(@PathVariable Long id) {
deleteCommentService.execute(id);
return ResponseEntity.noContent().build();
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
package com.woongeya.zoing.domain.comment.presetation;

import java.util.List;

import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.woongeya.zoing.domain.comment.presetation.dto.request.CreateCommentRequest;
import com.woongeya.zoing.domain.comment.presetation.dto.response.ReCommentResponse;
import com.woongeya.zoing.domain.comment.service.command.CreateReCommentService;
import com.woongeya.zoing.domain.comment.service.command.DeleteReCommentService;
import com.woongeya.zoing.domain.comment.service.command.UpdateReCommentService;
import com.woongeya.zoing.domain.comment.service.query.QueryReCommentListService;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import lombok.RequiredArgsConstructor;

@RestController
@RequiredArgsConstructor
Expand All @@ -23,25 +31,22 @@ public class ReCommentController {
private final UpdateReCommentService updateReCommentService;

@PostMapping("/{id}")
public ResponseEntity<Void> create(@PathVariable Long id, @RequestBody CreateCommentRequest request) {
public void create(@PathVariable Long id, @RequestBody CreateCommentRequest request) {
createReCommentService.execute(id, request);
return ResponseEntity.noContent().build();
}

@GetMapping("/{id}")
public ResponseEntity<List<ReCommentResponse>> findAll(@PathVariable Long id) {
return ResponseEntity.ok(queryReCommentListService.execute(id));
public List<ReCommentResponse> findAll(@PathVariable Long id) {
return queryReCommentListService.execute(id);
}

@DeleteMapping("/{id}")
public ResponseEntity<Void> delete(@PathVariable Long id) {
public void delete(@PathVariable Long id) {
deleteReCommentService.execute(id);
return ResponseEntity.noContent().build();
}

@PutMapping("/{id}")
public ResponseEntity<Void> update(@PathVariable Long id, @RequestBody CreateCommentRequest request) {
public void update(@PathVariable Long id, @RequestBody CreateCommentRequest request) {
updateReCommentService.execute(id, request);
return ResponseEntity.noContent().build();
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
package com.woongeya.zoing.domain.follow.presetation;

import java.util.List;

import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.woongeya.zoing.domain.follow.presetation.dto.reponse.FollowResponse;
import com.woongeya.zoing.domain.follow.service.*;
import com.woongeya.zoing.domain.follow.service.CountFollowerService;
import com.woongeya.zoing.domain.follow.service.CountFollowingService;
import com.woongeya.zoing.domain.follow.service.CreateFollowService;
import com.woongeya.zoing.domain.follow.service.DeleteFollowService;
import com.woongeya.zoing.domain.follow.service.FindFollowerService;
import com.woongeya.zoing.domain.follow.service.FindFollowingService;

import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequiredArgsConstructor
Expand All @@ -29,8 +40,8 @@ public void createFollow(@PathVariable Long id) {

@GetMapping("/{id}/following")
@Operation(summary = "유저의 모든 팔로잉 조회")
public ResponseEntity<List<FollowResponse>> findFollwing(@PathVariable Long id) {
return ResponseEntity.ok(findFollowingService.execute(id));
public List<FollowResponse> findFollwing(@PathVariable Long id) {
return findFollowingService.execute(id);
}

@GetMapping("/{id}/following/count")
Expand All @@ -41,8 +52,8 @@ public Integer countFollowing(@PathVariable Long id) {

@GetMapping("/{id}/follower")
@Operation(summary = "유저의 모든 팔로워 조회")
public ResponseEntity<List<FollowResponse>> findFollower(@PathVariable Long id) {
return ResponseEntity.ok(findFollowerService.execute(id));
public List<FollowResponse> findFollower(@PathVariable Long id) {
return findFollowerService.execute(id);
}

@GetMapping("/{id}/follower/count")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
package com.woongeya.zoing.domain.like.presentation;

import java.util.List;

import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.woongeya.zoing.domain.like.presentation.dto.response.LikerResponse;
import com.woongeya.zoing.domain.like.service.*;
import com.woongeya.zoing.domain.like.service.CheckLikeService;
import com.woongeya.zoing.domain.like.service.CountLikerService;
import com.woongeya.zoing.domain.like.service.CreateLikeService;
import com.woongeya.zoing.domain.like.service.DeleteLikeService;
import com.woongeya.zoing.domain.like.service.FindLikedService;
import com.woongeya.zoing.domain.like.service.FindLikerService;
import com.woongeya.zoing.domain.project.presetation.dto.response.ProjectResponse;

import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequiredArgsConstructor
Expand Down Expand Up @@ -37,14 +47,14 @@ public void unLike(@PathVariable Long id) {

@GetMapping("/{id}/liker")
@Operation(summary = "좋아요 누른 사람 조회")
public ResponseEntity<List<LikerResponse>> findLiker(@PathVariable Long id) {
return ResponseEntity.ok(findLikerService.execute(id));
public List<LikerResponse> findLiker(@PathVariable Long id) {
return findLikerService.execute(id);
}

@GetMapping("/my")
@Operation(summary = "내가 좋아요 누른 프로젝트 조회")
public ResponseEntity<List<ProjectResponse>> findLikedProject() {
return ResponseEntity.ok(findLikedService.execute());
public List<ProjectResponse> findLikedProject() {
return findLikedService.execute();
}

@GetMapping("/{id}/liker/count")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
package com.woongeya.zoing.domain.notice.presetation;

import java.util.List;

import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.woongeya.zoing.domain.notice.presetation.dto.response.NotificationResponse;
import com.woongeya.zoing.domain.notice.service.CountNotificationService;
import com.woongeya.zoing.domain.notice.service.DeleteAllNotificationService;
import com.woongeya.zoing.domain.notice.service.DeleteNotificationService;
import com.woongeya.zoing.domain.notice.service.FindNotificationService;

import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequiredArgsConstructor
Expand All @@ -24,8 +29,8 @@ public class NotificationController {

@GetMapping()
@Operation(summary = "현재 로그인 된 유저 알림 전체 조회")
public ResponseEntity<List<NotificationResponse>> findNotification() {
return ResponseEntity.ok(findNotificationService.execute());
public List<NotificationResponse> findNotification() {
return findNotificationService.execute();
}

@GetMapping("/count")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
package com.woongeya.zoing.domain.project.presetation;

import java.util.List;

import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.woongeya.zoing.domain.project.presetation.dto.request.MemberRequest;
import com.woongeya.zoing.domain.project.presetation.dto.response.MemberResponse;
import com.woongeya.zoing.domain.project.service.CheckMemberService;
import com.woongeya.zoing.domain.project.service.DeleteMemberService;
import com.woongeya.zoing.domain.project.service.FindProjectMemberService;

import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequiredArgsConstructor
Expand All @@ -29,8 +35,8 @@ public void delete(@PathVariable Long id, @RequestBody MemberRequest request) {

@GetMapping("/{id}")
@Operation(summary = "프로젝트 멤버 조회")
public ResponseEntity<List<MemberResponse>> findProjectMember(@PathVariable Long id) {
return ResponseEntity.ok(findProjectMemberService.execute(id)) ;
public List<MemberResponse> findProjectMember(@PathVariable Long id) {
return findProjectMemberService.execute(id);
}

@GetMapping("/check/{id}")
Expand Down
Loading

0 comments on commit d2b6c7b

Please sign in to comment.