From 56a3ddad27cc75b7d4e1342ce2dce1c30fb8b413 Mon Sep 17 00:00:00 2001 From: Marcel Schwarz Date: Tue, 28 Apr 2020 23:04:14 +0200 Subject: [PATCH] Create TimeRecord, Timetrackaccount and Role Move Entities in correct packages --- backend/build.gradle | 1 - .../de/hft/geotime/record/RecordRepository.java | 7 +++++++ .../geotime/{entities => record}/RecordType.java | 2 +- .../geotime/{entities => record}/TimeRecord.java | 4 ++-- .../hft/geotime/repositories/RoleRepository.java | 9 --------- .../hft/geotime/repositories/UserRepository.java | 15 --------------- .../de/hft/geotime/{entities => role}/Role.java | 2 +- .../java/de/hft/geotime/role/RoleRepository.java | 7 +++++++ .../TimetrackAccount.java | 3 ++- .../TimetrackAccountRepository.java | 7 +++++++ .../de/hft/geotime/{entities => user}/User.java | 4 +++- .../java/de/hft/geotime/user/UserRepository.java | 12 ++++++++++++ backend/src/main/resources/application.properties | 1 - 13 files changed, 42 insertions(+), 32 deletions(-) create mode 100644 backend/src/main/java/de/hft/geotime/record/RecordRepository.java rename backend/src/main/java/de/hft/geotime/{entities => record}/RecordType.java (59%) rename backend/src/main/java/de/hft/geotime/{entities => record}/TimeRecord.java (85%) delete mode 100644 backend/src/main/java/de/hft/geotime/repositories/RoleRepository.java delete mode 100644 backend/src/main/java/de/hft/geotime/repositories/UserRepository.java rename backend/src/main/java/de/hft/geotime/{entities => role}/Role.java (93%) create mode 100644 backend/src/main/java/de/hft/geotime/role/RoleRepository.java rename backend/src/main/java/de/hft/geotime/{entities => timetrackaccount}/TimetrackAccount.java (84%) create mode 100644 backend/src/main/java/de/hft/geotime/timetrackaccount/TimetrackAccountRepository.java rename backend/src/main/java/de/hft/geotime/{entities => user}/User.java (80%) create mode 100644 backend/src/main/java/de/hft/geotime/user/UserRepository.java diff --git a/backend/build.gradle b/backend/build.gradle index 7811350..4ea0a22 100644 --- a/backend/build.gradle +++ b/backend/build.gradle @@ -14,7 +14,6 @@ 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' implementation 'org.springframework.boot:spring-boot-starter-actuator' diff --git a/backend/src/main/java/de/hft/geotime/record/RecordRepository.java b/backend/src/main/java/de/hft/geotime/record/RecordRepository.java new file mode 100644 index 0000000..22b7906 --- /dev/null +++ b/backend/src/main/java/de/hft/geotime/record/RecordRepository.java @@ -0,0 +1,7 @@ +package de.hft.geotime.record; + +import org.springframework.data.repository.CrudRepository; + +public interface RecordRepository extends CrudRepository { + +} diff --git a/backend/src/main/java/de/hft/geotime/entities/RecordType.java b/backend/src/main/java/de/hft/geotime/record/RecordType.java similarity index 59% rename from backend/src/main/java/de/hft/geotime/entities/RecordType.java rename to backend/src/main/java/de/hft/geotime/record/RecordType.java index 5f3a684..1744c48 100644 --- a/backend/src/main/java/de/hft/geotime/entities/RecordType.java +++ b/backend/src/main/java/de/hft/geotime/record/RecordType.java @@ -1,4 +1,4 @@ -package de.hft.geotime.entities; +package de.hft.geotime.record; public enum RecordType { BREAK, diff --git a/backend/src/main/java/de/hft/geotime/entities/TimeRecord.java b/backend/src/main/java/de/hft/geotime/record/TimeRecord.java similarity index 85% rename from backend/src/main/java/de/hft/geotime/entities/TimeRecord.java rename to backend/src/main/java/de/hft/geotime/record/TimeRecord.java index 6a1cb94..3d9e888 100644 --- a/backend/src/main/java/de/hft/geotime/entities/TimeRecord.java +++ b/backend/src/main/java/de/hft/geotime/record/TimeRecord.java @@ -1,9 +1,9 @@ -package de.hft.geotime.entities; +package de.hft.geotime.record; +import de.hft.geotime.timetrackaccount.TimetrackAccount; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; -import org.hibernate.type.TimeType; import javax.persistence.Entity; import javax.persistence.Id; diff --git a/backend/src/main/java/de/hft/geotime/repositories/RoleRepository.java b/backend/src/main/java/de/hft/geotime/repositories/RoleRepository.java deleted file mode 100644 index d646c87..0000000 --- a/backend/src/main/java/de/hft/geotime/repositories/RoleRepository.java +++ /dev/null @@ -1,9 +0,0 @@ -package de.hft.geotime.repositories; - -import de.hft.geotime.entities.Role; -import org.springframework.data.repository.PagingAndSortingRepository; -import org.springframework.data.rest.core.annotation.RepositoryRestResource; - -@RepositoryRestResource -public interface RoleRepository extends PagingAndSortingRepository { -} diff --git a/backend/src/main/java/de/hft/geotime/repositories/UserRepository.java b/backend/src/main/java/de/hft/geotime/repositories/UserRepository.java deleted file mode 100644 index ac834cc..0000000 --- a/backend/src/main/java/de/hft/geotime/repositories/UserRepository.java +++ /dev/null @@ -1,15 +0,0 @@ -package de.hft.geotime.repositories; - -import de.hft.geotime.entities.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 { - - List findByUsername(@PathParam("username") String username); - -} diff --git a/backend/src/main/java/de/hft/geotime/entities/Role.java b/backend/src/main/java/de/hft/geotime/role/Role.java similarity index 93% rename from backend/src/main/java/de/hft/geotime/entities/Role.java rename to backend/src/main/java/de/hft/geotime/role/Role.java index 31bc9df..7b319b7 100644 --- a/backend/src/main/java/de/hft/geotime/entities/Role.java +++ b/backend/src/main/java/de/hft/geotime/role/Role.java @@ -1,4 +1,4 @@ -package de.hft.geotime.entities; +package de.hft.geotime.role; import lombok.AllArgsConstructor; import lombok.Data; diff --git a/backend/src/main/java/de/hft/geotime/role/RoleRepository.java b/backend/src/main/java/de/hft/geotime/role/RoleRepository.java new file mode 100644 index 0000000..7e26fa7 --- /dev/null +++ b/backend/src/main/java/de/hft/geotime/role/RoleRepository.java @@ -0,0 +1,7 @@ +package de.hft.geotime.role; + +import org.springframework.data.repository.CrudRepository; + +public interface RoleRepository extends CrudRepository { + +} diff --git a/backend/src/main/java/de/hft/geotime/entities/TimetrackAccount.java b/backend/src/main/java/de/hft/geotime/timetrackaccount/TimetrackAccount.java similarity index 84% rename from backend/src/main/java/de/hft/geotime/entities/TimetrackAccount.java rename to backend/src/main/java/de/hft/geotime/timetrackaccount/TimetrackAccount.java index b262bdc..0d38a12 100644 --- a/backend/src/main/java/de/hft/geotime/entities/TimetrackAccount.java +++ b/backend/src/main/java/de/hft/geotime/timetrackaccount/TimetrackAccount.java @@ -1,5 +1,6 @@ -package de.hft.geotime.entities; +package de.hft.geotime.timetrackaccount; +import de.hft.geotime.user.User; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; diff --git a/backend/src/main/java/de/hft/geotime/timetrackaccount/TimetrackAccountRepository.java b/backend/src/main/java/de/hft/geotime/timetrackaccount/TimetrackAccountRepository.java new file mode 100644 index 0000000..38bbc91 --- /dev/null +++ b/backend/src/main/java/de/hft/geotime/timetrackaccount/TimetrackAccountRepository.java @@ -0,0 +1,7 @@ +package de.hft.geotime.timetrackaccount; + +import org.springframework.data.repository.CrudRepository; + +public interface TimetrackAccountRepository extends CrudRepository { + +} diff --git a/backend/src/main/java/de/hft/geotime/entities/User.java b/backend/src/main/java/de/hft/geotime/user/User.java similarity index 80% rename from backend/src/main/java/de/hft/geotime/entities/User.java rename to backend/src/main/java/de/hft/geotime/user/User.java index 40fed8a..70c1b6e 100644 --- a/backend/src/main/java/de/hft/geotime/entities/User.java +++ b/backend/src/main/java/de/hft/geotime/user/User.java @@ -1,5 +1,7 @@ -package de.hft.geotime.entities; +package de.hft.geotime.user; +import de.hft.geotime.role.Role; +import de.hft.geotime.timetrackaccount.TimetrackAccount; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; diff --git a/backend/src/main/java/de/hft/geotime/user/UserRepository.java b/backend/src/main/java/de/hft/geotime/user/UserRepository.java new file mode 100644 index 0000000..2755da1 --- /dev/null +++ b/backend/src/main/java/de/hft/geotime/user/UserRepository.java @@ -0,0 +1,12 @@ +package de.hft.geotime.user; + +import org.springframework.data.repository.CrudRepository; + +import javax.websocket.server.PathParam; +import java.util.List; + +public interface UserRepository extends CrudRepository { + + List findByUsername(@PathParam("username") String username); + +} diff --git a/backend/src/main/resources/application.properties b/backend/src/main/resources/application.properties index 1cf2a4f..cae4ac3 100644 --- a/backend/src/main/resources/application.properties +++ b/backend/src/main/resources/application.properties @@ -1,5 +1,4 @@ server.port=80 -spring.data.rest.basePath=/api spring.datasource.hikari.initialization-fail-timeout=0 spring.datasource.hikari.max-lifetime=300000 spring.profiles.active=prod \ No newline at end of file