From 7db0d57a99c86c7e87fec78df76d2b49969aa6ed Mon Sep 17 00:00:00 2001 From: Filip Izydorczyk Date: Sat, 25 Jul 2020 10:38:19 +0200 Subject: [PATCH] Added assinment and user --- .../com/plannaplan/entities/Assignment.java | 24 ++++++++++ .../java/com/plannaplan/entities/User.java | 45 +++++++++++++++++++ .../repositories/AssignmentRepository.java | 11 +++++ .../repositories/UserRepository.java | 11 +++++ .../services/AssignmentService.java | 19 ++++++++ .../com/plannaplan/services/UserService.java | 20 +++++++++ .../java/com/plannaplan/types/UserRoles.java | 5 +++ 7 files changed, 135 insertions(+) create mode 100644 buisnesslogic/src/main/java/com/plannaplan/entities/Assignment.java create mode 100644 buisnesslogic/src/main/java/com/plannaplan/entities/User.java create mode 100644 buisnesslogic/src/main/java/com/plannaplan/repositories/AssignmentRepository.java create mode 100644 buisnesslogic/src/main/java/com/plannaplan/repositories/UserRepository.java create mode 100644 buisnesslogic/src/main/java/com/plannaplan/services/AssignmentService.java create mode 100644 buisnesslogic/src/main/java/com/plannaplan/services/UserService.java create mode 100644 buisnesslogic/src/main/java/com/plannaplan/types/UserRoles.java diff --git a/buisnesslogic/src/main/java/com/plannaplan/entities/Assignment.java b/buisnesslogic/src/main/java/com/plannaplan/entities/Assignment.java new file mode 100644 index 0000000..72e52f8 --- /dev/null +++ b/buisnesslogic/src/main/java/com/plannaplan/entities/Assignment.java @@ -0,0 +1,24 @@ +package com.plannaplan.entities; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; + +@Entity +public class Assignment { + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private Long id; + @ManyToOne + @JoinColumn(name = "group_id") + private Groups group; + @ManyToOne + @JoinColumn(name = "user_id") + private User user; + + public Assignment() { + } +} \ No newline at end of file diff --git a/buisnesslogic/src/main/java/com/plannaplan/entities/User.java b/buisnesslogic/src/main/java/com/plannaplan/entities/User.java new file mode 100644 index 0000000..c40d984 --- /dev/null +++ b/buisnesslogic/src/main/java/com/plannaplan/entities/User.java @@ -0,0 +1,45 @@ +package com.plannaplan.entities; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; + +import com.plannaplan.types.UserRoles; + +@Entity +public class User { + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private Long id; + private String name; + private String surname; + private UserRoles role; + + public User() { + } + + public String getName() { + return name; + } + + public UserRoles getRole() { + return role; + } + + public void setRole(UserRoles role) { + this.role = role; + } + + public String getSurname() { + return surname; + } + + public void setSurname(String surname) { + this.surname = surname; + } + + public void setName(String name) { + this.name = name; + } +} \ No newline at end of file diff --git a/buisnesslogic/src/main/java/com/plannaplan/repositories/AssignmentRepository.java b/buisnesslogic/src/main/java/com/plannaplan/repositories/AssignmentRepository.java new file mode 100644 index 0000000..19af52d --- /dev/null +++ b/buisnesslogic/src/main/java/com/plannaplan/repositories/AssignmentRepository.java @@ -0,0 +1,11 @@ +package com.plannaplan.repositories; + +import com.plannaplan.entities.Assignment; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface AssignmentRepository extends JpaRepository { + +} \ No newline at end of file diff --git a/buisnesslogic/src/main/java/com/plannaplan/repositories/UserRepository.java b/buisnesslogic/src/main/java/com/plannaplan/repositories/UserRepository.java new file mode 100644 index 0000000..19f1ac6 --- /dev/null +++ b/buisnesslogic/src/main/java/com/plannaplan/repositories/UserRepository.java @@ -0,0 +1,11 @@ +package com.plannaplan.repositories; + +import com.plannaplan.entities.User; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface UserRepository extends JpaRepository { + +} \ No newline at end of file diff --git a/buisnesslogic/src/main/java/com/plannaplan/services/AssignmentService.java b/buisnesslogic/src/main/java/com/plannaplan/services/AssignmentService.java new file mode 100644 index 0000000..a133d44 --- /dev/null +++ b/buisnesslogic/src/main/java/com/plannaplan/services/AssignmentService.java @@ -0,0 +1,19 @@ +package com.plannaplan.services; + +import com.plannaplan.interfaces.EventCreator; +import com.plannaplan.repositories.AssignmentRepository; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class AssignmentService implements EventCreator { + @Autowired + AssignmentRepository repo; + + @Override + public void update() { + // TODO Auto-generated method stub + + } +} \ No newline at end of file diff --git a/buisnesslogic/src/main/java/com/plannaplan/services/UserService.java b/buisnesslogic/src/main/java/com/plannaplan/services/UserService.java new file mode 100644 index 0000000..18ca809 --- /dev/null +++ b/buisnesslogic/src/main/java/com/plannaplan/services/UserService.java @@ -0,0 +1,20 @@ +package com.plannaplan.services; + +import com.plannaplan.interfaces.EventCreator; +import com.plannaplan.repositories.UserRepository; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class UserService implements EventCreator { + @Autowired + UserRepository repo; + + @Override + public void update() { + // TODO Auto-generated method stub + + } + +} \ No newline at end of file diff --git a/buisnesslogic/src/main/java/com/plannaplan/types/UserRoles.java b/buisnesslogic/src/main/java/com/plannaplan/types/UserRoles.java new file mode 100644 index 0000000..f56d2c5 --- /dev/null +++ b/buisnesslogic/src/main/java/com/plannaplan/types/UserRoles.java @@ -0,0 +1,5 @@ +package com.plannaplan.types; + +public enum UserRoles { + STUDENT, DEANERY, ADMIN +} \ No newline at end of file