Skip to content

Commit

Permalink
Merge pull request #152 from TRIP-Side-Project/dev
Browse files Browse the repository at this point in the history
Main merge
  • Loading branch information
gkfktkrh153 authored Dec 28, 2023
2 parents ec8330e + fcba414 commit b8cd6dc
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 5 deletions.
56 changes: 56 additions & 0 deletions src/main/java/com/api/trip/common/init/InitData.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package com.api.trip.common.init;

import com.api.trip.domain.article.model.Article;
import com.api.trip.domain.article.repository.ArticleRepository;
import com.api.trip.domain.comment.model.Comment;
import com.api.trip.domain.comment.repository.CommentRepository;
import com.api.trip.domain.interestitem.model.InterestItem;
import com.api.trip.domain.interestitem.repository.InterestItemRepository;
import com.api.trip.domain.interesttag.model.InterestTag;
import com.api.trip.domain.interesttag.respository.InterestTagRepository;
import com.api.trip.domain.item.model.Item;
import com.api.trip.domain.item.repository.ItemRepository;
import com.api.trip.domain.member.model.Member;
import com.api.trip.domain.member.model.SocialCode;
import com.api.trip.domain.member.repository.MemberRepository;
import com.api.trip.domain.tag.model.Tag;
import com.api.trip.domain.tag.repository.TagRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.security.crypto.password.PasswordEncoder;

@Configuration
@Profile("prod")
@RequiredArgsConstructor
public class InitData {


private final TagRepository tagRepository;

@Bean
public CommandLineRunner init() {
return args -> {

// 태그 생성
createTag();

};
}


private void createTag() {
String[] tags = {"부산", "제주", "서울", "요트", "경주", "눈꽃여행", "기차"};

for (String name : tags) {
Tag tag = Tag.builder()
.name(name)
.build();

tagRepository.save(tag);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.api.trip.common;
package com.api.trip.common.scheduler;


import com.api.trip.common.naverapi.NaverApiService;
Expand All @@ -13,18 +13,16 @@
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.stereotype.Component;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.client.HttpClientErrorException;

import java.util.List;
import java.util.Set;

@RequiredArgsConstructor
@Component
@EnableScheduling
@Slf4j
public class schedulerRunner {
public class SchedulerRunner {

private final NaverClient naverClient;
private final NaverApiService naverApiService;
Expand All @@ -44,7 +42,6 @@ public void updateData()
try {

while(true){
System.out.println("==========================");
ShoppingRequest request = ShoppingRequest.builder()
.start(1 + i * 50)
.display(50).build();
Expand Down

0 comments on commit b8cd6dc

Please sign in to comment.