run in dev profile for now, added user and trip seeder for development testing purposes
LocationBasedServices/sumoc-backend/pipeline/head This commit looks good
LocationBasedServices/sumoc-backend/pipeline/head This commit looks good
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
package SuMoC.backend.seed.user;
|
||||
|
||||
import SuMoC.backend.security.dtos.UserRegistrationDTO;
|
||||
import SuMoC.backend.security.services.AuthenticationService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@Profile("dev")
|
||||
@Order(1)
|
||||
public class DevUserSeeder implements CommandLineRunner {
|
||||
|
||||
private final AuthenticationService authenticationService;
|
||||
|
||||
@Autowired
|
||||
public DevUserSeeder(AuthenticationService authenticationService) {
|
||||
this.authenticationService = authenticationService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(String... args) throws Exception {
|
||||
UserRegistrationDTO user1 = UserRegistrationDTO.builder()
|
||||
.email("user1@email.com")
|
||||
.publicName("Nutzer 1 Public")
|
||||
.privateName("Nutzer 1 Privat")
|
||||
.password("password1")
|
||||
.build();
|
||||
authenticationService.registerUser(user1);
|
||||
UserRegistrationDTO user2 = UserRegistrationDTO.builder()
|
||||
.email("user2@email.com")
|
||||
.publicName("Nutzer 2 Public")
|
||||
.privateName("Nutzer 2 Privat")
|
||||
.password("password2")
|
||||
.build();
|
||||
authenticationService.registerUser(user2);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user