Adding DB for user management
This commit is contained in:
parent
26759154df
commit
aeeac91a32
13
build.gradle
13
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'
|
||||
|
||||
|
||||
|
72
src/main/java/net/Broken/DB/Entity/PendingUserEntity.java
Normal file
72
src/main/java/net/Broken/DB/Entity/PendingUserEntity.java
Normal file
@ -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;
|
||||
}
|
||||
}
|
71
src/main/java/net/Broken/DB/Entity/UserEntity.java
Normal file
71
src/main/java/net/Broken/DB/Entity/UserEntity.java
Normal file
@ -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;
|
||||
}
|
||||
}
|
@ -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<PendingUserEntity, Integer> {
|
||||
List<PendingUserEntity> findByJdaId(String jdaId);
|
||||
|
||||
|
||||
}
|
11
src/main/java/net/Broken/DB/Repository/UserRepository.java
Normal file
11
src/main/java/net/Broken/DB/Repository/UserRepository.java
Normal file
@ -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<UserEntity, Integer>{
|
||||
List<UserEntity> findByName(String name);
|
||||
List<UserEntity> findByJdaId(String jdaId);
|
||||
}
|
Loading…
Reference in New Issue
Block a user