-
Notifications
You must be signed in to change notification settings - Fork 3
Feature : user테이블에서 GitHub 정보 분리, reposiotory 정보 조회 및 저장 #110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
...ode/codetest/application/usermanagement/user/dto/request/UserGithubRepoSelectRequest.java
This file contains hidden or 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,9 @@ | ||
| package org.ezcode.codetest.application.usermanagement.user.dto.request; | ||
|
|
||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
|
|
||
| @Schema(description = "깃허브 repository 선택 요청") | ||
| public record UserGithubRepoSelectRequest( | ||
| @Schema(description = "repository 이름", example = "Practice coding") | ||
| String repositoryName | ||
| ) {} |
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -48,5 +48,9 @@ public String getGithubUrl() { | |
| return ""; | ||
| } | ||
|
|
||
| @Override | ||
| public String getOwner() { | ||
| return ""; | ||
| } | ||
|
|
||
| } | ||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -18,4 +18,8 @@ public interface OAuth2Response { | |
|
|
||
| //깃헙 링크 | ||
| String getGithubUrl(); | ||
|
|
||
|
|
||
| //깃헙 owner | ||
| String getOwner(); | ||
| } | ||
17 changes: 17 additions & 0 deletions
17
.../ezcode/codetest/application/usermanagement/user/dto/response/UserGithubRepoResponse.java
This file contains hidden or 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,17 @@ | ||
| package org.ezcode.codetest.application.usermanagement.user.dto.response; | ||
|
|
||
|
|
||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
| import lombok.Getter; | ||
|
|
||
| @Getter | ||
| @Schema(description = "유저의 Public Repository 리스트를 보여줍니다") | ||
| public class UserGithubRepoResponse { | ||
| private String repoName; | ||
| private String defaultBranch; | ||
|
|
||
| public UserGithubRepoResponse(String repoName, String defaultBranch) { | ||
| this.repoName = repoName; | ||
| this.defaultBranch = defaultBranch; | ||
| } | ||
| } |
17 changes: 17 additions & 0 deletions
17
src/main/java/org/ezcode/codetest/common/security/config/WebClientConfig.java
This file contains hidden or 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,17 @@ | ||
| package org.ezcode.codetest.common.security.config; | ||
|
|
||
| import org.springframework.context.annotation.Bean; | ||
| import org.springframework.context.annotation.Configuration; | ||
| import org.springframework.http.HttpHeaders; | ||
| import org.springframework.web.reactive.function.client.WebClient; | ||
|
|
||
| @Configuration | ||
| public class WebClientConfig { | ||
| @Bean | ||
| public WebClient githubWebClient() { | ||
| return WebClient.builder() | ||
| .baseUrl("https://api.github.com") | ||
| .defaultHeader(HttpHeaders.ACCEPT, "application/vnd.github+json") | ||
| .build(); | ||
| } | ||
| } | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
53 changes: 53 additions & 0 deletions
53
src/main/java/org/ezcode/codetest/domain/user/model/entity/UserGithubInfo.java
This file contains hidden or 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,53 @@ | ||
| package org.ezcode.codetest.domain.user.model.entity; | ||
|
|
||
| import jakarta.persistence.Column; | ||
| import jakarta.persistence.Entity; | ||
| import jakarta.persistence.FetchType; | ||
| import jakarta.persistence.GeneratedValue; | ||
| import jakarta.persistence.GenerationType; | ||
| import jakarta.persistence.Id; | ||
| import jakarta.persistence.JoinColumn; | ||
| import jakarta.persistence.OneToOne; | ||
| import jakarta.persistence.Table; | ||
| import lombok.Builder; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| @Entity | ||
| @Getter | ||
| @Table(name = "user_github") | ||
| @NoArgsConstructor | ||
| public class UserGithubInfo { | ||
|
|
||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| private Long id; | ||
|
|
||
| @OneToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "user_id", unique = true) | ||
| private User user; | ||
|
|
||
| @Column(nullable = false) | ||
| private String owner; | ||
|
|
||
| private String repo; | ||
|
|
||
| private String branch; | ||
|
|
||
| private String githubAccessToken; | ||
minjee2758 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| @Builder | ||
| public UserGithubInfo(User user, String owner) { | ||
| this.user = user; | ||
| this.owner = owner; | ||
| } | ||
|
|
||
| public void setGithubAccessToken(String githubAccessToken){ | ||
| this.githubAccessToken = githubAccessToken; | ||
| } | ||
|
|
||
| public void setGithubRepo(String githubRepoName, String defaultBranch) { | ||
| this.repo = githubRepoName; | ||
| this.branch = defaultBranch; | ||
| } | ||
| } | ||
13 changes: 13 additions & 0 deletions
13
src/main/java/org/ezcode/codetest/domain/user/repository/UserGithubInfoRepository.java
This file contains hidden or 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,13 @@ | ||
| package org.ezcode.codetest.domain.user.repository; | ||
|
|
||
| import org.ezcode.codetest.domain.user.model.entity.UserGithubInfo; | ||
|
|
||
| public interface UserGithubInfoRepository { | ||
| void createUserGithubInfo(UserGithubInfo userGithubInfo); | ||
|
|
||
| UserGithubInfo getUserGithubInfo(Long id); | ||
|
|
||
| void updateGithubAccessToken(UserGithubInfo userGithubInfo); | ||
|
|
||
| void updateGithubInfo(UserGithubInfo userGithub); | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
GitHub API 요청을 위해
User-Agent헤더 추가 및 URL 하드코딩 제거 제안GitHub API는
User-Agent헤더가 없는 요청을 거부합니다. 또한 베이스 URL을 소스에 하드코딩하면 테스트/스테이징 환경 분리가 어려워집니다.다음과 같이 수정하면 재사용성과 환경 분리가 용이합니다.
application.yml예시:🤖 Prompt for AI Agents