Added assinment and user
This commit is contained in:
		| @@ -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() { | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -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; | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -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<Assignment, Long> { | ||||||
|  |  | ||||||
|  | } | ||||||
| @@ -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<User, Long> { | ||||||
|  |  | ||||||
|  | } | ||||||
| @@ -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 | ||||||
|  |  | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -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 | ||||||
|  |  | ||||||
|  |     } | ||||||
|  |  | ||||||
|  | } | ||||||
| @@ -0,0 +1,5 @@ | |||||||
|  | package com.plannaplan.types; | ||||||
|  |  | ||||||
|  | public enum UserRoles { | ||||||
|  |     STUDENT, DEANERY, ADMIN | ||||||
|  | } | ||||||
		Reference in New Issue
	
	Block a user