diff --git a/server/src/main/java/com/project/Glog/controller/GitHubController.java b/server/src/main/java/com/project/Glog/controller/GitHubController.java index 1dec4a8..c616b79 100644 --- a/server/src/main/java/com/project/Glog/controller/GitHubController.java +++ b/server/src/main/java/com/project/Glog/controller/GitHubController.java @@ -67,7 +67,7 @@ public ResponseEntity getPullrequest(@CurrentUser UserPrincipa User user = userRepository.findById(userPrincipal.getId()).get(); String repo = gitHubService.getRepoName(categoryId); - GithubRepository githubRepository = githubRepoRepository.findRepoByUserId(user.getId(), repo).get(); + GithubRepository githubRepository = githubRepoRepository.findRepoByUserId(user.getId(), repo, categoryId).get(); List prInfos = gitHubService.getPr(user,githubRepository.getOwnerName(),repo); return new ResponseEntity<>(gitHubService.saveAndGetPr(prInfos, githubRepository, categoryId, user),HttpStatus.OK); diff --git a/server/src/main/java/com/project/Glog/repository/GithubRepoRepository.java b/server/src/main/java/com/project/Glog/repository/GithubRepoRepository.java index c802760..3130f4d 100644 --- a/server/src/main/java/com/project/Glog/repository/GithubRepoRepository.java +++ b/server/src/main/java/com/project/Glog/repository/GithubRepoRepository.java @@ -14,8 +14,8 @@ public interface GithubRepoRepository extends JpaRepository findByRepoName(@Param("userId") Long userid , @Param("reponame") String reponame); - @Query("SELECT gr FROM GithubRepository gr WHERE gr.user.id = :userId AND gr.repoName=:repo") - Optional findRepoByUserId(@Param("userId") Long userid, @Param("repo") String repo); + @Query("SELECT gr FROM GithubRepository gr WHERE gr.user.id = :userId AND gr.repoName=:repo AND gr.category.id=:categoryId") + Optional findRepoByUserId(@Param("userId") Long userid, @Param("repo") String repo,@Param("categoryId") Long categoryId); @Query("SELECT gr.repoName FROM GithubRepository gr WHERE gr.user.id = :userId AND gr.isCategoryRegi=false") List findRepoNameByUserId(@Param("userId") Long userid);