diff --git a/build.gradle b/build.gradle index 324379e..0ffa07c 100644 --- a/build.gradle +++ b/build.gradle @@ -34,12 +34,13 @@ dependencies { compile("com.sedmelluq:lavaplayer:1.2.45") compile 'net.dv8tion:JDA:3.3.1_303' compile group: 'org.json', name: 'json', version: '20160810' - // JPA Data (We are going to use Repositories, Entities, Hibernate, etc...) - //compile("org.springframework.boot:spring-boot-starter-data-jpa") { - // exclude group:"org.springframework.boot", module: "spring-boot-starter-logging" - //} - // Use MySQL Connector-J - //compile 'mysql:mysql-connector-java' + compile 'org.springframework.security:spring-security-web:5.0.1.RELEASE' +// JPA Data (We are going to use Repositories, Entities, Hibernate, etc...) + compile("org.springframework.boot:spring-boot-starter-data-jpa") { + exclude group:"org.springframework.boot", module: "spring-boot-starter-logging" + } +// Use MySQL Connector-J + compile 'mysql:mysql-connector-java' compile 'org.reflections:reflections:0.9.11' diff --git a/src/main/java/net/Broken/DB/Entity/PendingUserEntity.java b/src/main/java/net/Broken/DB/Entity/PendingUserEntity.java new file mode 100644 index 0000000..eb06cd7 --- /dev/null +++ b/src/main/java/net/Broken/DB/Entity/PendingUserEntity.java @@ -0,0 +1,72 @@ +package net.Broken.DB.Entity; + + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; + +@Entity +public class PendingUserEntity { + @Id + @GeneratedValue(strategy= GenerationType.AUTO) + private Integer id; + + private String name; + + private String jdaId; + + private String checkToken; + + private String password; + + public PendingUserEntity() { + } + + public PendingUserEntity(String name, String jdaId, String checkToken, String password) { + this.name = name; + this.jdaId = jdaId; + this.checkToken = checkToken; + this.password = password; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getJdaId() { + return jdaId; + } + + public void setJdaId(String jdaId) { + this.jdaId = jdaId; + } + + public String getCheckToken() { + return checkToken; + } + + public void setCheckToken(String checkToken) { + this.checkToken = checkToken; + } +} diff --git a/src/main/java/net/Broken/DB/Entity/UserEntity.java b/src/main/java/net/Broken/DB/Entity/UserEntity.java new file mode 100644 index 0000000..b0fafd7 --- /dev/null +++ b/src/main/java/net/Broken/DB/Entity/UserEntity.java @@ -0,0 +1,71 @@ +package net.Broken.DB.Entity; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; + +@Entity +public class UserEntity { + @Id + @GeneratedValue(strategy= GenerationType.AUTO) + private Integer id; + + private String name; + + private String jdaId; + + private String apiToken; + + private String password; + + public UserEntity() { + } + + public UserEntity(PendingUserEntity pendingUserEntity, String apiToken) { + this.name = pendingUserEntity.getName(); + this.jdaId = pendingUserEntity.getJdaId(); + this.password = pendingUserEntity.getPassword(); + this.apiToken = apiToken; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getJdaId() { + return jdaId; + } + + public void setJdaId(String jdaId) { + this.jdaId = jdaId; + } + + public String getApiToken() { + return apiToken; + } + + public void setApiToken(String apiToken) { + this.apiToken = apiToken; + } +} diff --git a/src/main/java/net/Broken/DB/Repository/PendingUserRepository.java b/src/main/java/net/Broken/DB/Repository/PendingUserRepository.java new file mode 100644 index 0000000..c72adbc --- /dev/null +++ b/src/main/java/net/Broken/DB/Repository/PendingUserRepository.java @@ -0,0 +1,12 @@ +package net.Broken.DB.Repository; + +import net.Broken.DB.Entity.PendingUserEntity; +import org.springframework.data.repository.CrudRepository; + +import java.util.List; + +public interface PendingUserRepository extends CrudRepository { + List findByJdaId(String jdaId); + + +} diff --git a/src/main/java/net/Broken/DB/Repository/UserRepository.java b/src/main/java/net/Broken/DB/Repository/UserRepository.java new file mode 100644 index 0000000..0d7ac63 --- /dev/null +++ b/src/main/java/net/Broken/DB/Repository/UserRepository.java @@ -0,0 +1,11 @@ +package net.Broken.DB.Repository; + +import net.Broken.DB.Entity.UserEntity; +import org.springframework.data.repository.CrudRepository; + +import java.util.List; + +public interface UserRepository extends CrudRepository{ + List findByName(String name); + List findByJdaId(String jdaId); +}