-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
07a4831
commit b8ea4c3
Showing
9 changed files
with
74 additions
and
85 deletions.
There are no files selected for viewing
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
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
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
30 changes: 14 additions & 16 deletions
30
src/main/java/com/khu/gitbox/domain/pullRequest/presentation/PullRequestController.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 |
---|---|---|
@@ -1,38 +1,36 @@ | ||
package com.khu.gitbox.domain.pullRequest.presentation; | ||
|
||
import com.khu.gitbox.auth.provider.JwtTokenProvider; | ||
import com.khu.gitbox.common.response.ApiResponse; | ||
import com.khu.gitbox.domain.pullRequest.application.PullRequestService; | ||
import com.khu.gitbox.domain.pullRequest.presentation.dto.PullRequestCommentCreateRequest; | ||
import com.khu.gitbox.domain.pullRequest.presentation.dto.PullRequestDto; | ||
import com.khu.gitbox.domain.pullRequest.presentation.dto.PullRequestGetResponse; | ||
import com.khu.gitbox.util.SecurityContextUtil; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/api/files/{fileId}") | ||
@RequestMapping("/api/pull-request") | ||
public class PullRequestController { | ||
|
||
private final PullRequestService pullRequestService; | ||
private final JwtTokenProvider jwtTokenProvider; | ||
|
||
@GetMapping("/pr") | ||
public ApiResponse<PullRequestDto> infoPullRequest(@PathVariable Long fileId) { | ||
PullRequestDto pullRequestDto = pullRequestService.infoPullRequest(fileId); | ||
|
||
return ApiResponse.ok(pullRequestDto); | ||
@Operation(summary = "PR 상세 정보 조회") | ||
@GetMapping("/{pullRequestId}") | ||
public ApiResponse<PullRequestGetResponse> getPullRequest(@PathVariable Long pullRequestId) { | ||
PullRequestGetResponse pullRequestGetResponse = pullRequestService.getPullRequest(pullRequestId); | ||
return ApiResponse.ok(pullRequestGetResponse); | ||
} | ||
|
||
@PostMapping("/pr") | ||
@Operation(summary = "PR 코멘트 생성 (PR 승인/거절)") | ||
@PostMapping("/{pullRequestId}/comments") | ||
public ApiResponse<Boolean> createPullRequestComment( | ||
@RequestBody PullRequestCommentCreateRequest pullRequestCommentCreateRequest, | ||
@PathVariable Long fileId) { | ||
|
||
@RequestBody PullRequestCommentCreateRequest commentCreateRequest, | ||
@PathVariable Long pullRequestId) { | ||
Long reviewerId = SecurityContextUtil.getCurrentMemberId(); | ||
pullRequestService.isApprovedPullRequest(pullRequestCommentCreateRequest, reviewerId, fileId); | ||
pullRequestService.createComment(commentCreateRequest, reviewerId, pullRequestId); | ||
|
||
return ApiResponse.created(pullRequestCommentCreateRequest.getIsApproved()); | ||
return ApiResponse.created(commentCreateRequest.getIsApproved()); | ||
} | ||
|
||
} |
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