Merge branch '12-implement-user-service' into 'master'

Resolve "Implement User Service"

Closes #12

See merge request marcel.schwarz/2020ss-qbc-geofence-timetracking!8
This commit is contained in:
Marcel Schwarz 2020-04-17 16:56:34 +00:00
commit e87bdc8e79
10 changed files with 84 additions and 19 deletions

2
backend/.gitignore vendored
View File

@ -116,3 +116,5 @@ fabric.properties
### VS Code ###
.vscode/
lombok.config

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile default="true" name="Default" enabled="true" />
<profile name="Gradle Imported" enabled="true">
<outputRelativeToContentRoot value="true" />
<processorPath useClasspath="false">
<entry name="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.projectlombok/lombok/1.18.12/48e4e5d60309ebd833bc528dcf77668eab3cd72c/lombok-1.18.12.jar" />
</processorPath>
<module name="geotime.main" />
</profile>
</annotationProcessing>
<bytecodeTargetLevel target="11" />
</component>
</project>

View File

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="11" project-jdk-type="JavaSDK" />
<component name="FrameworkDetectionExcludesConfiguration">
<file type="web" url="file://$PROJECT_DIR$" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK" />
</project>

View File

@ -0,0 +1,10 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="GeotimeApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
<module name="geotime.main" />
<option name="SPRING_BOOT_MAIN_CLASS" value="de.hft.geotime.GeotimeApplication" />
<option name="ALTERNATIVE_JRE_PATH" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>

View File

@ -1,6 +1,7 @@
plugins {
id 'org.springframework.boot' version '2.2.6.RELEASE'
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
id "io.freefair.lombok" version "5.0.0-rc6"
id 'java'
}
@ -15,6 +16,8 @@ repositories {
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-rest'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
runtimeOnly 'com.h2database:h2'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}

View File

@ -1,5 +1,6 @@
#Tue Apr 14 10:03:02 CEST 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

View File

@ -1,15 +0,0 @@
package de.hft.geotime.controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HelloWorldController {
@RequestMapping("/hello/{name}")
public String helloWorld(@PathVariable String name) {
return "Hello " + name;
}
}

View File

@ -0,0 +1,30 @@
package de.hft.geotime.user;
import lombok.Data;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@Data
@Entity
public class User {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
private String username;
private String firstname;
private String lastname;
//TODO: roleid(FK)
//TODO: timetrackaccounts[List]
protected User() {
}
public User(String firstname, String lastname) {
this.firstname = firstname;
this.lastname = lastname;
}
}

View File

@ -0,0 +1,14 @@
package de.hft.geotime.user;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import javax.websocket.server.PathParam;
import java.util.List;
@RepositoryRestResource
public interface UserRepository extends PagingAndSortingRepository<User, Long> {
List<User> findByUsername(@PathParam("username") String username);
}

View File

@ -1 +1,2 @@
server.port=80
server.port=80
spring.data.rest.basePath=/api