-
Notifications
You must be signed in to change notification settings - Fork 8
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
Showing
61 changed files
with
1,053 additions
and
1,019 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
backend/src/main/java/corea/auth/infrastructure/GithubPersonalAccessTokenProvider.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,33 @@ | ||
package corea.auth.infrastructure; | ||
|
||
import corea.global.config.Constants; | ||
import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.List; | ||
import java.util.Random; | ||
|
||
@EnableConfigurationProperties(GithubProperties.class) | ||
@Component | ||
public class GithubPersonalAccessTokenProvider { | ||
|
||
private static final Random RANDOM = new Random(); | ||
|
||
private final List<String> personalAccessTokens; | ||
|
||
public GithubPersonalAccessTokenProvider(GithubProperties githubProperties) { | ||
this.personalAccessTokens = githubProperties.pullRequest() | ||
.tokens(); | ||
} | ||
|
||
public String getRandomPersonalAccessToken() { | ||
if (personalAccessTokens.isEmpty()) { | ||
return ""; | ||
} | ||
return Constants.TOKEN_TYPE + personalAccessTokens.get(getRandomIndex()); | ||
} | ||
|
||
private int getRandomIndex() { | ||
return RANDOM.nextInt(personalAccessTokens.size()); | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package corea.global.util; | ||
|
||
import java.util.concurrent.CompletableFuture; | ||
import java.util.function.Supplier; | ||
|
||
public class FutureUtil { | ||
|
||
public static <T> CompletableFuture<T> supplyAsync(Supplier<T> supplier) { | ||
return CompletableFuture.supplyAsync(supplier); | ||
} | ||
} |
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
69 changes: 0 additions & 69 deletions
69
backend/src/main/java/corea/review/infrastructure/GithubCommentClient.java
This file was deleted.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
backend/src/main/java/corea/review/infrastructure/GithubPullRequestCommentClient.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,19 @@ | ||
package corea.review.infrastructure; | ||
|
||
import corea.auth.infrastructure.GithubPersonalAccessTokenProvider; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.web.client.RestClient; | ||
|
||
@Component | ||
public class GithubPullRequestCommentClient extends GithubReviewClient { | ||
|
||
public GithubPullRequestCommentClient(RestClient restClient, GithubPullRequestUrlExchanger githubPullRequestUrlExchanger, GithubPersonalAccessTokenProvider githubPersonalAccessTokenProvider) { | ||
super(restClient, githubPullRequestUrlExchanger, githubPersonalAccessTokenProvider); | ||
} | ||
|
||
@Override | ||
protected String prLinkToGithubApiUrl(String prLink) { | ||
GithubPullRequestUrlExchanger githubPullRequestUrlExchanger = getGithubPullRequestUrlExchanger(); | ||
return githubPullRequestUrlExchanger.prLinkToCommentApiUrl(prLink); | ||
} | ||
} |
Oops, something went wrong.