Skip to content

Commit

Permalink
Merge pull request #147 from capstone-kw-jjiggle/feature/#144-univCer…
Browse files Browse the repository at this point in the history
…tClearUser

[feat] #144 - mockData에서 khyojun 제거하고 학생 인증 테스트 진행
  • Loading branch information
khyojun authored Jun 18, 2024
2 parents 43f0ae1 + c574587 commit 01f8848
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 32 deletions.
32 changes: 1 addition & 31 deletions src/main/java/gitbal/backend/global/mock/MockDataGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,12 @@ public void run(String... args) throws Exception {
// Test를 위한 나(이승준)의 githubid와 동일한 nickname data

String lee = "leesj000603";
String khyojun = "khyojun";
if(userRepository.findByNickname(lee).isPresent() || userRepository.findByNickname(khyojun).isPresent()){
if(userRepository.findByNickname(lee).isPresent()){
log.info("duplicate");
return;
}

createUserWithNickname(lee);
createUserWithNickname2(khyojun);
userService.updateUserRank(); //user 순위 업데이트
userService.updateUserGrade(); // user 등급 업데이트
insertRegionSchoolTopContributorInfo();
Expand All @@ -102,34 +100,6 @@ public void run(String... args) throws Exception {
log.info("Mock data creation completed!!!!!!");
}

private void createUserWithNickname2(String username) {
School school = schoolRepository.findById(1L)
.orElse(null);
Region region = regionRepository.findById(1L)
.orElse(null);
OneDayCommit oneDayCommit = OneDayCommit.of(true);
oneDayCommitRepository.save(oneDayCommit);


User khyojun = User.builder()
.school(school)
.region(region)
.nickname(username)
.score(500L)
.profile_img("sdqsdqwefqwef")
.grade(Grade.PURPLE)
.build();

List<MajorLanguage> majorLanguages2 = createRandomMajorLanguagesForUser(khyojun);
majorLanguages2.forEach(majorLanguageRepository::save);

OneDayCommit oneDayCommit2 = OneDayCommit.of(false);
oneDayCommitRepository.save(oneDayCommit2);
khyojun.joinUpdateUser(school, region, oneDayCommit2, majorLanguages2,
khyojun.getNickname(), khyojun.getScore(), khyojun.getProfile_img(), Grade.YELLOW, 0);
userRepository.save(khyojun);

}

private User createUser(String randomNickname, School school, Region region, int index) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public abstract class UserSetup {
protected List<String> getAllUsernames(UserService userService){
//List<String> allUserNames = userService.findAllUserNames();
// TODO : 임시로 진행하여 임의의 github id 로 등록 진행
List<String> allUserNames = List.of(userService.findByUserName("khyojun").getNickname(),
List<String> allUserNames = List.of(
userService.findByUserName("leesj000603").getNickname()
);
return allUserNames;
Expand Down

0 comments on commit 01f8848

Please sign in to comment.