diff --git a/build/classes/java/main/bssm/db/bssmgit/domain/post/entity/Category$CategoryBuilder.class b/build/classes/java/main/bssm/db/bssmgit/domain/post/entity/Category$CategoryBuilder.class index c44717b..1d08b4b 100644 Binary files a/build/classes/java/main/bssm/db/bssmgit/domain/post/entity/Category$CategoryBuilder.class and b/build/classes/java/main/bssm/db/bssmgit/domain/post/entity/Category$CategoryBuilder.class differ diff --git a/build/classes/java/main/bssm/db/bssmgit/domain/post/entity/Category.class b/build/classes/java/main/bssm/db/bssmgit/domain/post/entity/Category.class index b9b8455..0de6c43 100644 Binary files a/build/classes/java/main/bssm/db/bssmgit/domain/post/entity/Category.class and b/build/classes/java/main/bssm/db/bssmgit/domain/post/entity/Category.class differ diff --git a/build/classes/java/main/bssm/db/bssmgit/domain/post/entity/Likes$LikesBuilder.class b/build/classes/java/main/bssm/db/bssmgit/domain/post/entity/Likes$LikesBuilder.class index bf94b01..86e9f80 100644 Binary files a/build/classes/java/main/bssm/db/bssmgit/domain/post/entity/Likes$LikesBuilder.class and b/build/classes/java/main/bssm/db/bssmgit/domain/post/entity/Likes$LikesBuilder.class differ diff --git a/build/classes/java/main/bssm/db/bssmgit/domain/post/entity/Likes.class b/build/classes/java/main/bssm/db/bssmgit/domain/post/entity/Likes.class index 5b5c699..ef7a22e 100644 Binary files a/build/classes/java/main/bssm/db/bssmgit/domain/post/entity/Likes.class and b/build/classes/java/main/bssm/db/bssmgit/domain/post/entity/Likes.class differ diff --git a/build/classes/java/main/bssm/db/bssmgit/domain/post/entity/Post$PostBuilder.class b/build/classes/java/main/bssm/db/bssmgit/domain/post/entity/Post$PostBuilder.class index 508a324..0f638e5 100644 Binary files a/build/classes/java/main/bssm/db/bssmgit/domain/post/entity/Post$PostBuilder.class and b/build/classes/java/main/bssm/db/bssmgit/domain/post/entity/Post$PostBuilder.class differ diff --git a/build/classes/java/main/bssm/db/bssmgit/domain/post/entity/Post.class b/build/classes/java/main/bssm/db/bssmgit/domain/post/entity/Post.class index d44b97e..a54d89e 100644 Binary files a/build/classes/java/main/bssm/db/bssmgit/domain/post/entity/Post.class and b/build/classes/java/main/bssm/db/bssmgit/domain/post/entity/Post.class differ diff --git a/build/classes/java/main/bssm/db/bssmgit/domain/post/web/api/PostApiController.class b/build/classes/java/main/bssm/db/bssmgit/domain/post/web/api/PostApiController.class index 833010d..21125a9 100644 Binary files a/build/classes/java/main/bssm/db/bssmgit/domain/post/web/api/PostApiController.class and b/build/classes/java/main/bssm/db/bssmgit/domain/post/web/api/PostApiController.class differ diff --git a/build/classes/java/main/bssm/db/bssmgit/domain/post/web/dto/req/PostCreateRequestDto$PostCreateRequestDtoBuilder.class b/build/classes/java/main/bssm/db/bssmgit/domain/post/web/dto/req/PostCreateRequestDto$PostCreateRequestDtoBuilder.class index 3d362ab..7092ae2 100644 Binary files a/build/classes/java/main/bssm/db/bssmgit/domain/post/web/dto/req/PostCreateRequestDto$PostCreateRequestDtoBuilder.class and b/build/classes/java/main/bssm/db/bssmgit/domain/post/web/dto/req/PostCreateRequestDto$PostCreateRequestDtoBuilder.class differ diff --git a/build/classes/java/main/bssm/db/bssmgit/domain/post/web/dto/req/PostCreateRequestDto.class b/build/classes/java/main/bssm/db/bssmgit/domain/post/web/dto/req/PostCreateRequestDto.class index 2ab7a15..f54d03c 100644 Binary files a/build/classes/java/main/bssm/db/bssmgit/domain/post/web/dto/req/PostCreateRequestDto.class and b/build/classes/java/main/bssm/db/bssmgit/domain/post/web/dto/req/PostCreateRequestDto.class differ diff --git a/build/classes/java/main/bssm/db/bssmgit/domain/user/domain/ImaginaryNumber$ImaginaryNumberBuilder.class b/build/classes/java/main/bssm/db/bssmgit/domain/user/domain/ImaginaryNumber$ImaginaryNumberBuilder.class index 377f9d3..5fd182a 100644 Binary files a/build/classes/java/main/bssm/db/bssmgit/domain/user/domain/ImaginaryNumber$ImaginaryNumberBuilder.class and b/build/classes/java/main/bssm/db/bssmgit/domain/user/domain/ImaginaryNumber$ImaginaryNumberBuilder.class differ diff --git a/build/classes/java/main/bssm/db/bssmgit/domain/user/domain/ImaginaryNumber.class b/build/classes/java/main/bssm/db/bssmgit/domain/user/domain/ImaginaryNumber.class index 1acc290..de158dd 100644 Binary files a/build/classes/java/main/bssm/db/bssmgit/domain/user/domain/ImaginaryNumber.class and b/build/classes/java/main/bssm/db/bssmgit/domain/user/domain/ImaginaryNumber.class differ diff --git a/build/classes/java/main/bssm/db/bssmgit/domain/user/domain/User$UserBuilder.class b/build/classes/java/main/bssm/db/bssmgit/domain/user/domain/User$UserBuilder.class index 3504e83..182a7ca 100644 Binary files a/build/classes/java/main/bssm/db/bssmgit/domain/user/domain/User$UserBuilder.class and b/build/classes/java/main/bssm/db/bssmgit/domain/user/domain/User$UserBuilder.class differ diff --git a/build/classes/java/main/bssm/db/bssmgit/domain/user/domain/User.class b/build/classes/java/main/bssm/db/bssmgit/domain/user/domain/User.class index 13cb107..d4dad0d 100644 Binary files a/build/classes/java/main/bssm/db/bssmgit/domain/user/domain/User.class and b/build/classes/java/main/bssm/db/bssmgit/domain/user/domain/User.class differ diff --git a/build/classes/java/main/bssm/db/bssmgit/domain/user/facade/UserFacade.class b/build/classes/java/main/bssm/db/bssmgit/domain/user/facade/UserFacade.class index 930f683..82dcf5c 100644 Binary files a/build/classes/java/main/bssm/db/bssmgit/domain/user/facade/UserFacade.class and b/build/classes/java/main/bssm/db/bssmgit/domain/user/facade/UserFacade.class differ diff --git a/build/classes/java/main/bssm/db/bssmgit/domain/user/repository/UserRepository.class b/build/classes/java/main/bssm/db/bssmgit/domain/user/repository/UserRepository.class index 9bfb5ac..c9ccbd0 100644 Binary files a/build/classes/java/main/bssm/db/bssmgit/domain/user/repository/UserRepository.class and b/build/classes/java/main/bssm/db/bssmgit/domain/user/repository/UserRepository.class differ diff --git a/build/classes/java/main/bssm/db/bssmgit/domain/user/service/AuthService$1.class b/build/classes/java/main/bssm/db/bssmgit/domain/user/service/AuthService$1.class index a2f931d..9e57259 100644 Binary files a/build/classes/java/main/bssm/db/bssmgit/domain/user/service/AuthService$1.class and b/build/classes/java/main/bssm/db/bssmgit/domain/user/service/AuthService$1.class differ diff --git a/build/classes/java/main/bssm/db/bssmgit/domain/user/service/AuthService.class b/build/classes/java/main/bssm/db/bssmgit/domain/user/service/AuthService.class index fc8aa70..7732b06 100644 Binary files a/build/classes/java/main/bssm/db/bssmgit/domain/user/service/AuthService.class and b/build/classes/java/main/bssm/db/bssmgit/domain/user/service/AuthService.class differ diff --git a/build/classes/java/main/bssm/db/bssmgit/domain/user/service/BojService.class b/build/classes/java/main/bssm/db/bssmgit/domain/user/service/BojService.class index d69a498..95ee5d3 100644 Binary files a/build/classes/java/main/bssm/db/bssmgit/domain/user/service/BojService.class and b/build/classes/java/main/bssm/db/bssmgit/domain/user/service/BojService.class differ diff --git a/build/classes/java/main/bssm/db/bssmgit/domain/user/service/GithubService.class b/build/classes/java/main/bssm/db/bssmgit/domain/user/service/GithubService.class index 236d722..ff6f97f 100644 Binary files a/build/classes/java/main/bssm/db/bssmgit/domain/user/service/GithubService.class and b/build/classes/java/main/bssm/db/bssmgit/domain/user/service/GithubService.class differ diff --git a/build/classes/java/main/bssm/db/bssmgit/domain/user/service/ImaginaryNumberService.class b/build/classes/java/main/bssm/db/bssmgit/domain/user/service/ImaginaryNumberService.class index 03499d1..ccfe8d5 100644 Binary files a/build/classes/java/main/bssm/db/bssmgit/domain/user/service/ImaginaryNumberService.class and b/build/classes/java/main/bssm/db/bssmgit/domain/user/service/ImaginaryNumberService.class differ diff --git a/build/classes/java/main/bssm/db/bssmgit/domain/user/web/api/AuthApiController.class b/build/classes/java/main/bssm/db/bssmgit/domain/user/web/api/AuthApiController.class index a911449..9c9a998 100644 Binary files a/build/classes/java/main/bssm/db/bssmgit/domain/user/web/api/AuthApiController.class and b/build/classes/java/main/bssm/db/bssmgit/domain/user/web/api/AuthApiController.class differ diff --git a/build/classes/java/main/bssm/db/bssmgit/domain/user/web/api/ImaginaryNumberApiController.class b/build/classes/java/main/bssm/db/bssmgit/domain/user/web/api/ImaginaryNumberApiController.class index 3decccb..4962457 100644 Binary files a/build/classes/java/main/bssm/db/bssmgit/domain/user/web/api/ImaginaryNumberApiController.class and b/build/classes/java/main/bssm/db/bssmgit/domain/user/web/api/ImaginaryNumberApiController.class differ diff --git a/build/classes/java/main/bssm/db/bssmgit/domain/user/web/api/UserApiController.class b/build/classes/java/main/bssm/db/bssmgit/domain/user/web/api/UserApiController.class index 2432a91..308d9ad 100644 Binary files a/build/classes/java/main/bssm/db/bssmgit/domain/user/web/api/UserApiController.class and b/build/classes/java/main/bssm/db/bssmgit/domain/user/web/api/UserApiController.class differ diff --git a/build/tmp/compileJava/previous-compilation-data.bin b/build/tmp/compileJava/previous-compilation-data.bin index 0949857..ec0e0f9 100644 Binary files a/build/tmp/compileJava/previous-compilation-data.bin and b/build/tmp/compileJava/previous-compilation-data.bin differ diff --git a/src/main/java/bssm/db/bssmgit/domain/user/domain/User.java b/src/main/java/bssm/db/bssmgit/domain/user/domain/User.java index 9e3652d..6ad2f39 100644 --- a/src/main/java/bssm/db/bssmgit/domain/user/domain/User.java +++ b/src/main/java/bssm/db/bssmgit/domain/user/domain/User.java @@ -73,7 +73,7 @@ public class User { @Column(length = 8) private Integer commits; - @Column(length = 128) + @Column(length = 1024) private String githubMsg; @Column diff --git a/src/main/java/bssm/db/bssmgit/domain/user/repository/UserRepository.java b/src/main/java/bssm/db/bssmgit/domain/user/repository/UserRepository.java index dbb6d73..5350bc0 100644 --- a/src/main/java/bssm/db/bssmgit/domain/user/repository/UserRepository.java +++ b/src/main/java/bssm/db/bssmgit/domain/user/repository/UserRepository.java @@ -30,4 +30,6 @@ public interface UserRepository extends JpaRepository { "bssm.db.bssmgit.domain.user.domain.type.Imaginary.IMAGINARY_NUMBER") List findByUserImaginaryUser(); -} \ No newline at end of file + void deleteByGithubId(String githubId); + +} diff --git a/src/main/java/bssm/db/bssmgit/domain/user/service/GithubService.java b/src/main/java/bssm/db/bssmgit/domain/user/service/GithubService.java index ffb93c8..86f402d 100644 --- a/src/main/java/bssm/db/bssmgit/domain/user/service/GithubService.java +++ b/src/main/java/bssm/db/bssmgit/domain/user/service/GithubService.java @@ -11,14 +11,17 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.io.BufferedReader; +import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; import java.net.URLConnection; import java.util.List; import static bssm.db.bssmgit.global.exception.ErrorCode.GIT_CONNECTION_REFUSED; +import static bssm.db.bssmgit.global.util.Constants.EVERY_10MINUTES; import static bssm.db.bssmgit.global.util.Constants.EVERY_5MINUTES; import static bssm.db.bssmgit.global.util.Constants.REGEX_FOR_COMMIT; @@ -39,7 +42,8 @@ private void connectToGithub(String token) throws IOException { github.checkApiUrlValidity(); } - @Scheduled(cron = EVERY_5MINUTES) + @Scheduled(cron = EVERY_10MINUTES) + @Transactional public void updateUserGithubInfo() throws IOException { connectGithub(); List users = userRepository.findAll(); @@ -47,7 +51,7 @@ public void updateUserGithubInfo() throws IOException { for (int i = 0, userSize = users.size(); i < userSize; i++) { User user = users.get(i); if (user.hasNotGithubId()) { - return; + continue; } Integer commit = getCommit(user.getGithubId()); String bio = github.getUser(user.getGithubId()).getBio(); @@ -67,6 +71,22 @@ private Integer getCommit(String githubId) throws IOException { return Integer.parseInt(commitSymbol); } + @Scheduled(cron = EVERY_5MINUTES) + @Transactional + public void deleteNotFoundGithubIdUser() throws IOException { + List users = userRepository.findAll(); + for (int i = 0, userSize = users.size(); i < userSize; i++) { + User user = users.get(i); + try { + URLConnection connection = GithubUtil.getGithubUrlConnection(user.getGithubId()); + connection.getInputStream(); + } catch (FileNotFoundException e) { + log.info("{}를 찾을 수 없음 -> 해당 유저 깃허브 아이디 자동 삭제 처리", e.getMessage()); + userRepository.deleteByGithubId(user.getGithubId()); + } + } + } + private static String getCommitSymbol(BufferedReader br) throws IOException { boolean isMatchRegexForCommit = false; String inputLine; diff --git a/src/main/java/bssm/db/bssmgit/domain/user/web/api/UserApiController.java b/src/main/java/bssm/db/bssmgit/domain/user/web/api/UserApiController.java index 9560bd6..8e733de 100644 --- a/src/main/java/bssm/db/bssmgit/domain/user/web/api/UserApiController.java +++ b/src/main/java/bssm/db/bssmgit/domain/user/web/api/UserApiController.java @@ -7,6 +7,7 @@ import bssm.db.bssmgit.domain.user.web.dto.response.UserResponseDto; import bssm.db.bssmgit.global.generic.Result; import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -45,4 +46,8 @@ public void test() throws IOException { githubService.updateUserGithubInfo(); } + @DeleteMapping("/test") + public void deleteTest() throws IOException { + githubService.deleteNotFoundGithubIdUser(); + } } diff --git a/src/main/java/bssm/db/bssmgit/global/util/Constants.java b/src/main/java/bssm/db/bssmgit/global/util/Constants.java index 0789c64..12803ab 100644 --- a/src/main/java/bssm/db/bssmgit/global/util/Constants.java +++ b/src/main/java/bssm/db/bssmgit/global/util/Constants.java @@ -6,6 +6,7 @@ public class Constants { public static final String BOJ_URL = "https://solved.ac/api/v3/user/show?handle="; public static final String REGEX_FOR_COMMIT = "

"; + public static final String EVERY_10MINUTES = "0 0/5 * * * ?"; public static final String EVERY_5MINUTES = "0 0/5 * * * ?"; public static final String EVERY_50MINUTES = "0 0/50 * * * ?"; }