-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* refactor: Room Controller 역할 분리 * refactor: 피드백 반영 --------- Co-authored-by: youngsu5582 <[email protected]>
- Loading branch information
1 parent
f6beb1a
commit 83c7406
Showing
10 changed files
with
303 additions
and
179 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
backend/src/main/java/corea/matchresult/controller/MatchingResultController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package corea.matchresult.controller; | ||
|
||
import corea.auth.annotation.LoginMember; | ||
import corea.auth.domain.AuthInfo; | ||
import corea.matchresult.dto.MatchResultResponses; | ||
import corea.matchresult.service.MatchResultService; | ||
import lombok.RequiredArgsConstructor; | ||
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.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequestMapping("/rooms") | ||
@RequiredArgsConstructor | ||
public class MatchingResultController implements MatchingResultControllerSpecification { | ||
|
||
private final MatchResultService matchResultService; | ||
|
||
@GetMapping("/{id}/reviewers") | ||
public ResponseEntity<MatchResultResponses> reviewers(@PathVariable long id, @LoginMember AuthInfo authInfo) { | ||
MatchResultResponses response = matchResultService.findReviewers(authInfo.getId(), id); | ||
return ResponseEntity.ok(response); | ||
} | ||
|
||
@GetMapping("/{id}/reviewees") | ||
public ResponseEntity<MatchResultResponses> reviewees(@PathVariable long id, @LoginMember AuthInfo authInfo) { | ||
MatchResultResponses response = matchResultService.findReviewees(authInfo.getId(), id); | ||
return ResponseEntity.ok(response); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...end/src/main/java/corea/matchresult/controller/MatchingResultControllerSpecification.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package corea.matchresult.controller; | ||
|
||
import corea.auth.domain.AuthInfo; | ||
import corea.exception.ExceptionType; | ||
import corea.global.annotation.ApiErrorResponses; | ||
import corea.matchresult.dto.MatchResultResponses; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.Parameter; | ||
import org.springframework.http.ResponseEntity; | ||
|
||
public interface MatchingResultControllerSpecification { | ||
@Operation(summary = "해당 방에서 나에게 배정된 리뷰어들의 정보를 반환합니다.", | ||
description = "해당 방에서 자신에게 배정된 리뷰어를 확인합니다. <br>" + | ||
"요청 시 `Authorization Header`에 `Bearer JWT token`을 포함시켜야 합니다. " + | ||
"이 토큰을 기반으로 `AuthInfo` 객체가 생성되며 사용자의 정보가 자동으로 주입됩니다. <br>" + | ||
"JWT 토큰에서 추출된 사용자 정보는 피드백 작성에 필요한 인증된 사용자 정보를 제공합니다. " + | ||
"<br><br>**참고:** 이 API를 사용하기 위해서는 유효한 JWT 토큰이 필요하며, " + | ||
"토큰이 없거나 유효하지 않은 경우 인증 오류가 발생합니다.") | ||
@ApiErrorResponses(value = {ExceptionType.MEMBER_NOT_FOUND, ExceptionType.ROOM_NOT_FOUND}) | ||
ResponseEntity<MatchResultResponses> reviewers(@Parameter(description = "방 아이디", example = "1") | ||
long id, | ||
AuthInfo authInfo); | ||
|
||
@Operation(summary = "해당 방에서 나에게 배정된 리뷰이들의 정보를 반환합니다.", | ||
description = "해당 방에서 자신에게 배정된 리뷰이를 확인합니다. <br>" + | ||
"요청 시 `Authorization Header`에 `Bearer JWT token`을 포함시켜야 합니다. " + | ||
"이 토큰을 기반으로 `AuthInfo` 객체가 생성되며 사용자의 정보가 자동으로 주입됩니다. <br>" + | ||
"JWT 토큰에서 추출된 사용자 정보는 피드백 작성에 필요한 인증된 사용자 정보를 제공합니다. " + | ||
"<br><br>**참고:** 이 API를 사용하기 위해서는 유효한 JWT 토큰이 필요하며, " + | ||
"토큰이 없거나 유효하지 않은 경우 인증 오류가 발생합니다.") | ||
@ApiErrorResponses(value = {ExceptionType.MEMBER_NOT_FOUND, ExceptionType.ROOM_NOT_FOUND}) | ||
ResponseEntity<MatchResultResponses> reviewees(@Parameter(description = "방 아이디", example = "1") | ||
long id, | ||
AuthInfo authInfo); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
backend/src/main/java/corea/room/controller/RoomInquiryController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package corea.room.controller; | ||
|
||
import corea.auth.annotation.AccessedMember; | ||
import corea.auth.domain.AuthInfo; | ||
import corea.room.domain.RoomStatus; | ||
import corea.room.dto.RoomResponses; | ||
import corea.room.service.RoomInquiryService; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequestMapping("/rooms") | ||
@RequiredArgsConstructor | ||
public class RoomInquiryController implements RoomInquiryControllerSpecification { | ||
|
||
private final RoomInquiryService roomInquiryService; | ||
|
||
@GetMapping("/opened") | ||
public ResponseEntity<RoomResponses> openedRooms(@AccessedMember AuthInfo authInfo, | ||
@RequestParam(defaultValue = "0") int page, | ||
@RequestParam(value = "classification", defaultValue = "all") String expression) { | ||
RoomResponses response = roomInquiryService.findRoomsWithRoomStatus(authInfo.getId(), page, expression, RoomStatus.OPEN); | ||
return ResponseEntity.ok(response); | ||
} | ||
|
||
@GetMapping("/progress") | ||
public ResponseEntity<RoomResponses> progressRooms(@AccessedMember AuthInfo authInfo, | ||
@RequestParam(defaultValue = "0") int page, | ||
@RequestParam(value = "classification", defaultValue = "all") String expression) { | ||
RoomResponses response = roomInquiryService.findRoomsWithRoomStatus(authInfo.getId(), page, expression, RoomStatus.PROGRESS); | ||
return ResponseEntity.ok(response); | ||
} | ||
|
||
@GetMapping("/closed") | ||
public ResponseEntity<RoomResponses> closedRooms(@AccessedMember AuthInfo authInfo, | ||
@RequestParam(defaultValue = "0") int page, | ||
@RequestParam(value = "classification", defaultValue = "all") String expression) { | ||
RoomResponses response = roomInquiryService.findRoomsWithRoomStatus(authInfo.getId(), page, expression, RoomStatus.CLOSE); | ||
return ResponseEntity.ok(response); | ||
} | ||
} |
Oops, something went wrong.