2020-06-09 18:14:49 +02:00
|
|
|
package com.plannaplan;
|
|
|
|
|
2020-09-14 12:39:25 +02:00
|
|
|
import com.plannaplan.entities.User;
|
|
|
|
import com.plannaplan.services.UserService;
|
|
|
|
import com.plannaplan.types.UserRoles;
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
2020-06-09 18:14:49 +02:00
|
|
|
import org.springframework.boot.SpringApplication;
|
|
|
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
2020-09-14 12:39:25 +02:00
|
|
|
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
|
|
|
import org.springframework.context.event.EventListener;
|
2020-06-09 18:14:49 +02:00
|
|
|
|
|
|
|
@SpringBootApplication
|
|
|
|
public class App {
|
2020-06-10 10:53:22 +02:00
|
|
|
|
2020-09-15 11:31:30 +02:00
|
|
|
public final static String API_VERSION = "v1";
|
|
|
|
|
2020-09-14 12:39:25 +02:00
|
|
|
@Autowired
|
|
|
|
UserService userService;
|
|
|
|
|
2020-06-09 18:14:49 +02:00
|
|
|
public static void main(String[] args) {
|
2020-08-24 11:10:01 +02:00
|
|
|
Logo logo = new Logo("beta");
|
|
|
|
System.out.println(logo.getLogo());
|
2020-09-14 12:39:25 +02:00
|
|
|
System.out.println(
|
|
|
|
"|=============================================================================================|");
|
2020-06-09 18:14:49 +02:00
|
|
|
SpringApplication.run(App.class, args);
|
|
|
|
}
|
2020-09-14 12:39:25 +02:00
|
|
|
|
2020-09-14 12:55:47 +02:00
|
|
|
@EventListener(ApplicationReadyEvent.class)
|
|
|
|
public void importData() {
|
|
|
|
User testUser = new User();
|
2020-09-25 16:17:52 +02:00
|
|
|
testUser.setEmail("notexisting@mail.comain");
|
|
|
|
testUser.setName("Tom");
|
|
|
|
testUser.setSurname("Riddle");
|
|
|
|
testUser.setRole(UserRoles.TEST_USER);
|
2020-09-14 12:55:47 +02:00
|
|
|
this.userService.save(testUser);
|
2020-09-25 16:17:52 +02:00
|
|
|
|
|
|
|
User filip = new User();
|
|
|
|
filip.setEmail("filizy@st.amu.edu.pl");
|
|
|
|
filip.setName("Filip");
|
|
|
|
filip.setSurname("Izydorczyk");
|
|
|
|
filip.setRole(UserRoles.STUDENT);
|
|
|
|
this.userService.save(filip);
|
2020-09-14 12:55:47 +02:00
|
|
|
}
|
2020-06-09 18:14:49 +02:00
|
|
|
}
|