feat(user-service): 유저 서비스 테스트 데이터 입력 클래스 생성
This commit is contained in:
@@ -1,12 +1,8 @@
|
|||||||
package com.justpickup.userservice;
|
package com.justpickup.userservice;
|
||||||
|
|
||||||
import com.justpickup.userservice.domain.user.dto.StoreOwnerDto;
|
|
||||||
import com.justpickup.userservice.domain.user.service.UserService;
|
|
||||||
import org.springframework.boot.CommandLineRunner;
|
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
|
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@EnableEurekaClient
|
@EnableEurekaClient
|
||||||
@@ -16,13 +12,4 @@ public class UserServiceApplication {
|
|||||||
SpringApplication.run(UserServiceApplication.class, args);
|
SpringApplication.run(UserServiceApplication.class, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
|
||||||
CommandLineRunner run(UserService userService) {
|
|
||||||
return args -> {
|
|
||||||
StoreOwnerDto park = StoreOwnerDto.builder()
|
|
||||||
.email("test@gmail.com").password("1234").name("Park").phoneNumber("010-1234-5678")
|
|
||||||
.build();
|
|
||||||
userService.saveStoreOwner(park);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.justpickup.userservice.domain.user.repository;
|
||||||
|
|
||||||
|
import com.justpickup.userservice.domain.user.entity.StoreOwner;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface StoreOwnerRepository extends JpaRepository<StoreOwner, Long> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.justpickup.userservice.global;
|
||||||
|
|
||||||
|
import com.justpickup.userservice.domain.user.entity.AuthType;
|
||||||
|
import com.justpickup.userservice.domain.user.entity.Customer;
|
||||||
|
import com.justpickup.userservice.domain.user.entity.StoreOwner;
|
||||||
|
import com.justpickup.userservice.domain.user.repository.CustomerRepository;
|
||||||
|
import com.justpickup.userservice.domain.user.repository.StoreOwnerRepository;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.boot.CommandLineRunner;
|
||||||
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class SqlCommandLineRunner implements CommandLineRunner {
|
||||||
|
|
||||||
|
private final BCryptPasswordEncoder bCryptPasswordEncoder;
|
||||||
|
private final StoreOwnerRepository storeOwnerRepository;
|
||||||
|
private final CustomerRepository customerRepository;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run(String... args) throws Exception {
|
||||||
|
String encode = bCryptPasswordEncoder.encode("1234");
|
||||||
|
|
||||||
|
StoreOwner owner = new StoreOwner("owner@gmail.com", encode,
|
||||||
|
"점주 테스트 계정", "010-9876-5432", null);
|
||||||
|
storeOwnerRepository.save(owner);
|
||||||
|
|
||||||
|
Customer customer = new Customer("customer@gmail.com", encode,
|
||||||
|
"고객 테스트 계정", "010-1234-5678", AuthType.NAVER);
|
||||||
|
customerRepository.save(customer);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
server.port: 60000
|
server.port: 0
|
||||||
|
|
||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
@@ -47,10 +47,11 @@ logging:
|
|||||||
decorator.datasource.p6spy:
|
decorator.datasource.p6spy:
|
||||||
enable-logging: true
|
enable-logging: true
|
||||||
|
|
||||||
|
# 3600000
|
||||||
token:
|
token:
|
||||||
access-expired-time: 3600000
|
access-expired-time: 3600000
|
||||||
refresh-expired-time: 604800000
|
refresh-expired-time: 604800000
|
||||||
secret: my-secret
|
secret: $2a$10$q42lY7Y18xqrFt1qbODZIO4OMTeOxnrCe7tF3n9bazJinVE7VH5Pi
|
||||||
refresh-token-name: refresh-token
|
refresh-token-name: refresh-token
|
||||||
access-token-name: access-token
|
access-token-name: access-token
|
||||||
fegin: eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJmZWlnbiIsImV4cCI6MTE2NDY5NzY4NzAsImlhdCI6MTY0Njk3Njg3MH0.5x4Nx7oMnpF0_kZpbZsiB1u9eEbQ4IKIhJlEsa3D22cjZjvTHKz57GCz0sgXb_olhSNIVv9xF41A29-XYiFeBQ
|
fegin: eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJmZWlnbiIsImV4cCI6MTE2NDY5NzY4NzAsImlhdCI6MTY0Njk3Njg3MH0.5x4Nx7oMnpF0_kZpbZsiB1u9eEbQ4IKIhJlEsa3D22cjZjvTHKz57GCz0sgXb_olhSNIVv9xF41A29-XYiFeBQ
|
||||||
Reference in New Issue
Block a user