Index: springapp/src/main/java/mk/profesori/springapp/Controller/MainController.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Controller/MainController.java	(revision 9506ca8f1d1d14c1a16be0d016d016240b436344)
+++ springapp/src/main/java/mk/profesori/springapp/Controller/MainController.java	(revision 9506ca8f1d1d14c1a16be0d016d016240b436344)
@@ -0,0 +1,72 @@
+package mk.profesori.springapp.Controller;
+
+import java.util.List;
+import java.util.Optional;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import mk.profesori.springapp.Model.City;
+import mk.profesori.springapp.Model.Faculty;
+import mk.profesori.springapp.Model.Professor;
+import mk.profesori.springapp.Model.University;
+import mk.profesori.springapp.Service.MainService;
+
+@RestController
+public class MainController {
+    
+    @Autowired
+    private MainService mainService;
+
+    @RequestMapping(value = "/professors", method = RequestMethod.GET)
+    public List<Professor> getProfessorsByFaculty(@RequestParam Optional<Long> facultyId) {
+
+        if(!facultyId.isPresent()) return mainService.getAllProfessors(); //ako nema parametar facultyId gi vrakja site profesori
+        return mainService.getProfessorsByFacultyId(facultyId.get());
+    }
+
+    @RequestMapping(value = "/professor/{professorId}", method = RequestMethod.GET)
+    public Professor getProfessorById(@PathVariable Long professorId) {
+        return mainService.getProfessorById(professorId);
+    }
+
+    @RequestMapping(value = "/faculties", method = RequestMethod.GET)
+    public List<Faculty> getFacultiesByUniversity(@RequestParam Optional<Long> universityId) {
+
+        if(!universityId.isPresent()) return mainService.getAllFaculties(); //ako nema parametar universityId gi vrakja site fakulteti
+        return mainService.getFacultiesByUniversityId(universityId.get());
+    }
+
+    @RequestMapping(value = "/faculty/{facultyId}", method = RequestMethod.GET)
+    public Faculty getFacultyById(@PathVariable Long facultyId) {
+        return mainService.getFacultyById(facultyId);
+    }
+
+    @RequestMapping(value = "/universities", method = RequestMethod.GET)
+    public List<University> getUniversitiesByCity(@RequestParam Optional<Long> cityId) {
+
+        if(!cityId.isPresent()) return mainService.getAllUniversities(); //ako nema parametar cityId gi vrakja site univerziteti
+        return mainService.getUniversitiesByCityId(cityId.get());
+    }
+
+    @RequestMapping(value = "/university/{universityId}", method = RequestMethod.GET)
+    public University getUniversityById(@PathVariable Long universityId) {
+        return mainService.getUniversityById(universityId);
+    }
+
+    @RequestMapping(value = "/cities", method = RequestMethod.GET)
+    public List<City> getCities() {
+        return mainService.getAllCities();  //gi vrakja site gradovi
+    }
+
+    @RequestMapping(value = "/city/{cityId}", method = RequestMethod.GET)
+    public City getCityById(@PathVariable Long cityId) {
+        return mainService.getCityById(cityId);
+    }
+
+    
+}
Index: springapp/src/main/java/mk/profesori/springapp/Controller/PublicController.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Controller/PublicController.java	(revision ebc51762bbd1b4345d8908789af87bdc49aad058)
+++ 	(revision )
@@ -1,109 +1,0 @@
-package mk.profesori.springapp.Controller;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.CrossOrigin;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
-import mk.profesori.springapp.Model.City;
-import mk.profesori.springapp.Model.Faculty;
-import mk.profesori.springapp.Model.Professor;
-import mk.profesori.springapp.Model.StudyProgramme;
-import mk.profesori.springapp.Model.University;
-import mk.profesori.springapp.Service.MainService;
-
-@RestController
-@RequestMapping("/public")
-@CrossOrigin(origins = { "http://192.168.0.17:3000", "http://192.168.0.24:3000" })
-public class PublicController {
-
-    @Autowired
-    private MainService mainService;
-
-    @RequestMapping(value = "/professors", method = RequestMethod.GET)
-    public List<Professor> getProfessorsByFaculty(@RequestParam Optional<Long> facultyId) {
-
-        if (!facultyId.isPresent())
-            return mainService.getAllProfessors(); // ako nema parametar facultyId gi vrakja site profesori
-
-        return mainService.getProfessorsByFacultyId(facultyId.get());
-    }
-
-    @RequestMapping(value = "/professors/nameContains/{contained}", method = RequestMethod.GET)
-    public List<Professor> getProfessorsByNameContains(@PathVariable String contained) {
-        return mainService.getProfessorsByNameContains(contained); // vrakja profesori sto sodrzat "contained" vo
-                                                                   // professorName
-    }
-
-    @RequestMapping(value = "/professor/{professorId}", method = RequestMethod.GET)
-    public Professor getProfessorById(@PathVariable Long professorId) {
-        return mainService.getProfessorById(professorId); // vrakja profesor spored id
-    }
-
-    @RequestMapping(value = "/study_programmes", method = RequestMethod.GET)
-    public List<StudyProgramme> getStudyProgrammesByFaculty(@RequestParam Optional<Long> facultyId) {
-
-        if (!facultyId.isPresent())
-            return mainService.getAllStudyProgrammes(); // ako nema parametar facultyId gi vrakja site studiski programi
-        return mainService.getStudyProgrammesByFacultyId(facultyId.get());
-    }
-
-    @RequestMapping(value = "/study_programme/{studyProgrammeId}", method = RequestMethod.GET)
-    public StudyProgramme getStudyProgrammeById(@PathVariable Long studyProgrammeId) {
-        return mainService.getStudyProgrammeById(studyProgrammeId); // vrakja studiska programa spored id
-    }
-
-    @RequestMapping(value = "/faculties", method = RequestMethod.GET)
-    public List<Faculty> getFacultiesByUniversity(@RequestParam Optional<Long> universityId) {
-
-        if (!universityId.isPresent())
-            return mainService.getAllFaculties(); // ako nema parametar universityId gi vrakja site fakulteti
-        return mainService.getFacultiesByUniversityId(universityId.get());
-    }
-
-    @RequestMapping(value = "/faculty/{facultyId}", method = RequestMethod.GET)
-    public Faculty getFacultyById(@PathVariable Long facultyId) {
-        return mainService.getFacultyById(facultyId); // vrakja fakultet spored id
-    }
-
-    @RequestMapping(value = "/universities", method = RequestMethod.GET)
-    public List<University> getUniversitiesByCity(@RequestParam Optional<Long> cityId) {
-
-        if (!cityId.isPresent())
-            return mainService.getAllUniversities(); // ako nema parametar cityId gi vrakja site univerziteti
-        return mainService.getUniversitiesByCityId(cityId.get());
-    }
-
-    @RequestMapping(value = "/university/{universityId}", method = RequestMethod.GET)
-    public University getUniversityById(@PathVariable Long universityId) {
-        return mainService.getUniversityById(universityId); // vrakja univerzitet spored id
-    }
-
-    @RequestMapping(value = "/cities", method = RequestMethod.GET)
-    public List<City> getCities() {
-        return mainService.getAllCities(); // gi vrakja site gradovi
-    }
-
-    @RequestMapping(value = "/city/{cityId}", method = RequestMethod.GET)
-    public City getCityById(@PathVariable Long cityId) {
-        return mainService.getCityById(cityId); // vrakja grad spored id
-    }
-
-    @RequestMapping(value = "/loginSuccessRegular", method = RequestMethod.GET)
-    public Map<String, String> loginSuccessRegular(@RequestParam String sessionId) {
-        return Collections.singletonMap("sessionId", sessionId);
-    }
-
-    @RequestMapping(value = "/loginSuccessModerator", method = RequestMethod.GET)
-    public Map<String, String> loginSuccessModerator(@RequestParam String sessionId) {
-        return Collections.singletonMap("sessionId", sessionId);
-    }
-}
Index: springapp/src/main/java/mk/profesori/springapp/Controller/RegistrationController.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Controller/RegistrationController.java	(revision ebc51762bbd1b4345d8908789af87bdc49aad058)
+++ 	(revision )
@@ -1,30 +1,0 @@
-package mk.profesori.springapp.Controller;
-
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
-import lombok.AllArgsConstructor;
-import mk.profesori.springapp.Model.RegistrationRequest;
-import mk.profesori.springapp.Service.RegistrationService;
-
-@RestController
-@RequestMapping(path = "/registration")
-@AllArgsConstructor
-public class RegistrationController {
-
-    private RegistrationService registrationService;
-    
-    @PostMapping
-    public String register(@RequestBody RegistrationRequest request) {
-        return registrationService.register(request);
-    }
-
-    @GetMapping(path = "confirm")
-    public String confirm(@RequestParam("token") String token) {
-        return registrationService.confirmToken(token);
-    }
-}
Index: springapp/src/main/java/mk/profesori/springapp/Controller/SecureController.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Controller/SecureController.java	(revision ebc51762bbd1b4345d8908789af87bdc49aad058)
+++ 	(revision )
@@ -1,98 +1,0 @@
-package mk.profesori.springapp.Controller;
-
-import java.util.Collections;
-import java.util.Map;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.core.Authentication;
-import org.springframework.security.core.annotation.CurrentSecurityContext;
-import org.springframework.security.core.context.SecurityContext;
-import org.springframework.security.core.userdetails.UserDetails;
-import org.springframework.web.bind.annotation.CrossOrigin;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-import mk.profesori.springapp.Model.CustomUserDetails;
-import mk.profesori.springapp.Service.CustomUserDetailsService;
-import mk.profesori.springapp.Service.MainService;
-
-@RestController
-@RequestMapping("/secure")
-@CrossOrigin(origins = { "http://192.168.0.17:3000", "http://192.168.0.24:3000" })
-public class SecureController {
-
-    @Autowired
-    private MainService mainService;
-    @Autowired
-    CustomUserDetailsService customUserDetailsService;
-
-    @RequestMapping(value = "/professor/{professorId}/addOpinion", method = RequestMethod.POST)
-    public void addOpinion(@RequestBody ObjectNode objectNode, @PathVariable Long professorId,
-            @CurrentSecurityContext SecurityContext context) {
-
-        Authentication authentication = context.getAuthentication();
-
-        if (authentication != null && authentication.getPrincipal() instanceof CustomUserDetails) {
-            CustomUserDetails currentUser = (CustomUserDetails) authentication.getPrincipal();
-            String title = objectNode.get("title").asText();
-            String content = objectNode.get("content").asText();
-            mainService.addOpinion(title, content, professorId, currentUser);
-        }
-    }
-
-    @RequestMapping(value = "/professor/{professorId}/replyToOpinion/{postId}", method = RequestMethod.POST)
-    public void replyToOpinion(@RequestBody ObjectNode objectNode, @PathVariable Long professorId,
-            @PathVariable Long postId, @CurrentSecurityContext SecurityContext context) {
-
-        Authentication authentication = context.getAuthentication();
-
-        if (authentication != null && authentication.getPrincipal() instanceof CustomUserDetails) {
-            CustomUserDetails currentUser = (CustomUserDetails) authentication.getPrincipal();
-            String content = objectNode.get("content").asText();
-            mainService.replyToOpinion(content, professorId, postId, currentUser);
-        }
-    }
-
-    @RequestMapping(value = "/currentUser", method = RequestMethod.GET)
-    public UserDetails getUserDetails(@CurrentSecurityContext SecurityContext context) {
-
-        Authentication authentication = context.getAuthentication();
-        if (authentication != null && authentication.getPrincipal() instanceof CustomUserDetails) {
-            CustomUserDetails currentUser = (CustomUserDetails) authentication.getPrincipal();
-            return customUserDetailsService.loadUserByUsername(currentUser.getEmail());
-        }
-
-        return null;
-    }
-
-    @RequestMapping(value = "/professor/{professorId}/upvoteOpinion/{postId}", method = RequestMethod.GET)
-    public void upvoteOpinion(@PathVariable Long professorId,
-            @PathVariable Long postId, @CurrentSecurityContext SecurityContext context) {
-
-        Authentication authentication = context.getAuthentication();
-
-        if (authentication != null && authentication.getPrincipal() instanceof CustomUserDetails) {
-            CustomUserDetails currentUser = (CustomUserDetails) authentication.getPrincipal();
-            mainService.upvoteOpinion(postId, currentUser);
-        }
-    }
-
-    @RequestMapping(value = "/professor/{professorId}/downvoteOpinion/{postId}", method = RequestMethod.GET)
-    public void downvoteOpinion(@PathVariable Long professorId,
-            @PathVariable Long postId, @CurrentSecurityContext SecurityContext context) {
-
-        Authentication authentication = context.getAuthentication();
-
-        if (authentication != null && authentication.getPrincipal() instanceof CustomUserDetails) {
-            CustomUserDetails currentUser = (CustomUserDetails) authentication.getPrincipal();
-            mainService.downvoteOpinion(postId, currentUser);
-        }
-    }
-
-}
Index: springapp/src/main/java/mk/profesori/springapp/Model/City.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Model/City.java	(revision ebc51762bbd1b4345d8908789af87bdc49aad058)
+++ springapp/src/main/java/mk/profesori/springapp/Model/City.java	(revision 9506ca8f1d1d14c1a16be0d016d016240b436344)
@@ -12,10 +12,8 @@
 import javax.persistence.Table;
 
-import com.fasterxml.jackson.annotation.JsonIdentityInfo;
-import com.fasterxml.jackson.annotation.ObjectIdGenerators;
+import com.fasterxml.jackson.annotation.JsonManagedReference;
 
 @Entity
 @Table(name = "city")
-@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "cityId")
 public class City {
 
@@ -31,5 +29,5 @@
     private Set<University> universities = new HashSet<>();
 
-    // getters
+    //getters
     public Long getCityId() {
         return cityId;
@@ -40,7 +38,8 @@
     }
 
+    @JsonManagedReference
     public Set<University> getUniversities() {
         return universities;
     }
-
+    
 }
Index: springapp/src/main/java/mk/profesori/springapp/Model/ConfirmationToken.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Model/ConfirmationToken.java	(revision ebc51762bbd1b4345d8908789af87bdc49aad058)
+++ 	(revision )
@@ -1,52 +1,0 @@
-package mk.profesori.springapp.Model;
-
-import java.time.LocalDateTime;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.SequenceGenerator;
-
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-
-@Getter
-@Setter
-@NoArgsConstructor
-@Entity
-public class ConfirmationToken {
-    
-    @Id
-    @SequenceGenerator(name = "confirmation_token_sequence", sequenceName = "confirmation_token_sequence", allocationSize = 1)
-    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "confirmation_token_sequence")
-    private Long id;
-
-    @Column(nullable = false)
-    private String token;
-
-    @Column(nullable = false)
-    private LocalDateTime createdAt;
-
-    @Column(nullable = false)
-    private LocalDateTime expiresAt;
-
-    private LocalDateTime confirmedAt;
-
-    @ManyToOne()
-    @JoinColumn(nullable = false, name = "custom_user_details_id")
-    private CustomUserDetails customUserDetails;
-
-    public ConfirmationToken(String token, LocalDateTime createdAt, LocalDateTime expiredAt, 
-    CustomUserDetails customUserDetails) {
-        
-        this.token = token;
-        this.createdAt = createdAt;
-        this.expiresAt = expiredAt;
-        this.customUserDetails = customUserDetails;
-    }
-}
Index: springapp/src/main/java/mk/profesori/springapp/Model/CustomUserDetails.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Model/CustomUserDetails.java	(revision ebc51762bbd1b4345d8908789af87bdc49aad058)
+++ 	(revision )
@@ -1,139 +1,0 @@
-package mk.profesori.springapp.Model;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.persistence.CascadeType;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinTable;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToMany;
-import javax.persistence.OneToMany;
-import javax.persistence.SequenceGenerator;
-
-import org.springframework.security.core.GrantedAuthority;
-import org.springframework.security.core.authority.SimpleGrantedAuthority;
-import org.springframework.security.core.userdetails.UserDetails;
-
-import com.fasterxml.jackson.annotation.JsonIdentityInfo;
-import com.voodoodyne.jackson.jsog.JSOGGenerator;
-
-import lombok.EqualsAndHashCode;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-
-@Getter
-@Setter
-@EqualsAndHashCode
-@NoArgsConstructor
-@Entity
-@JsonIdentityInfo(generator = JSOGGenerator.class)
-public class CustomUserDetails implements UserDetails {
-
-    @Id
-    @SequenceGenerator(name = "user_sequence", sequenceName = "user_sequence", allocationSize = 1)
-    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "user_sequence")
-    private Long id;
-    private String fullName; // opcionalno, smee da e prazno
-    private String username;
-    private String email;
-    private String password; // TODO dont expose password in api
-    @Enumerated(EnumType.STRING)
-    private UserRole userRole;
-    private Boolean locked = false;
-    private Boolean enabled = false;
-    @OneToMany(mappedBy = "customUserDetails", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
-    private Set<ConfirmationToken> confirmationTokens = new HashSet<>();
-    @OneToMany(mappedBy = "author", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
-    private Set<Post> authoredPosts = new HashSet<>();
-    private Integer karma = 0;
-    @ManyToMany(fetch = FetchType.EAGER)
-    @JoinTable(name = "post_like", joinColumns = @JoinColumn(name = "custom_user_details_id"), inverseJoinColumns = @JoinColumn(name = "post_id"))
-    Set<Post> likedPosts;
-    @ManyToMany(fetch = FetchType.EAGER)
-    @JoinTable(name = "post_dislike", joinColumns = @JoinColumn(name = "custom_user_details_id"), inverseJoinColumns = @JoinColumn(name = "post_id"))
-    Set<Post> dislikedPosts;
-
-    public CustomUserDetails(String fullName, String username, String email, String password, UserRole userRole) {
-        this.fullName = fullName;
-        this.username = username;
-        this.email = email;
-        this.password = password;
-        this.userRole = userRole;
-    }
-
-    @Override
-    public Collection<? extends GrantedAuthority> getAuthorities() {
-        SimpleGrantedAuthority authority = new SimpleGrantedAuthority(userRole.name());
-        return Collections.singletonList(authority);
-    }
-
-    @Override
-    public String getPassword() {
-        return password;
-    }
-
-    @Override
-    public String getUsername() {
-        return username;
-    }
-
-    @Override
-    public boolean isAccountNonExpired() {
-        return true;
-    }
-
-    @Override
-    public boolean isAccountNonLocked() {
-        return !locked;
-    }
-
-    @Override
-    public boolean isCredentialsNonExpired() {
-        return true;
-    }
-
-    @Override
-    public boolean isEnabled() {
-        return enabled;
-    }
-
-    public Set<Post> getAuthoredPosts() {
-        return this.authoredPosts;
-    }
-
-    public Integer getKarma() {
-        return this.karma;
-    }
-
-    public void setKarma(Integer karma) {
-        this.karma = karma;
-    }
-
-    public Set<Post> getLikedPosts() {
-        return this.likedPosts;
-    }
-
-    public void setLikedPosts(Set<Post> likedPosts) {
-        this.likedPosts = likedPosts;
-    }
-
-    public Set<Post> getDislikedPosts() {
-        return this.dislikedPosts;
-    }
-
-    public void setDislikedPosts(Set<Post> dislikedPosts) {
-        this.likedPosts = dislikedPosts;
-    }
-}
Index: springapp/src/main/java/mk/profesori/springapp/Model/Faculty.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Model/Faculty.java	(revision ebc51762bbd1b4345d8908789af87bdc49aad058)
+++ springapp/src/main/java/mk/profesori/springapp/Model/Faculty.java	(revision 9506ca8f1d1d14c1a16be0d016d016240b436344)
@@ -14,10 +14,9 @@
 import javax.persistence.Table;
 
-import com.fasterxml.jackson.annotation.JsonIdentityInfo;
-import com.voodoodyne.jackson.jsog.JSOGGenerator;
+import com.fasterxml.jackson.annotation.JsonBackReference;
+import com.fasterxml.jackson.annotation.JsonManagedReference;
 
 @Entity
 @Table(name = "faculty")
-@JsonIdentityInfo(generator = JSOGGenerator.class)
 public class Faculty {
 
@@ -40,5 +39,5 @@
     private Set<StudyProgramme> studyProgrammes = new HashSet<>();
 
-    // getters
+    //getters
     public Long getFacultyId() {
         return facultyId;
@@ -49,15 +48,18 @@
     }
 
+    @JsonBackReference
     public University getUniversity() {
         return university;
     }
 
+    @JsonManagedReference
     public Set<Professor> getProfessors() {
         return professors;
     }
 
+    @JsonManagedReference
     public Set<StudyProgramme> getStudyProgrammes() {
         return studyProgrammes;
     }
-
+    
 }
Index: springapp/src/main/java/mk/profesori/springapp/Model/Opinion.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Model/Opinion.java	(revision ebc51762bbd1b4345d8908789af87bdc49aad058)
+++ 	(revision )
@@ -1,46 +1,0 @@
-package mk.profesori.springapp.Model;
-
-import java.time.LocalDateTime;
-import java.util.List;
-
-import javax.persistence.DiscriminatorValue;
-import javax.persistence.Entity;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-
-import lombok.NoArgsConstructor;
-
-@Entity
-@DiscriminatorValue("opinion")
-@NoArgsConstructor
-public class Opinion extends Post {
-
-    @ManyToOne
-    @JoinColumn(name = "professor_id")
-    private Professor targetProfessor;
-
-    // konstruktor so parent (koga e reply)
-    public Opinion(String title, String content, CustomUserDetails author, LocalDateTime timePosted,
-            LocalDateTime timeLastEdited,
-            Post parent, List<Post> children, Professor targetProfessor) {
-        super(title, content, author, timePosted, timeLastEdited, parent, children);
-        this.targetProfessor = targetProfessor;
-    }
-
-    // konstruktor bez parent (koga NE e reply)
-    public Opinion(String title, String content, CustomUserDetails author, LocalDateTime timePosted,
-            LocalDateTime timeLastEdited,
-            List<Post> children, Professor targetProfessor) {
-        super(title, content, author, timePosted, timeLastEdited, children);
-        this.targetProfessor = targetProfessor;
-    }
-
-    // getters and setters
-    public Professor getTargetProfessor() {
-        return targetProfessor;
-    }
-
-    public void setTargetProfessor(Professor targetProfessor) {
-        this.targetProfessor = targetProfessor;
-    }
-}
Index: springapp/src/main/java/mk/profesori/springapp/Model/Post.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Model/Post.java	(revision ebc51762bbd1b4345d8908789af87bdc49aad058)
+++ 	(revision )
@@ -1,176 +1,0 @@
-package mk.profesori.springapp.Model;
-
-import java.time.LocalDateTime;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.DiscriminatorColumn;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Inheritance;
-import javax.persistence.DiscriminatorType;
-import javax.persistence.InheritanceType;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToMany;
-import javax.persistence.ManyToOne;
-import javax.persistence.OneToMany;
-
-import com.fasterxml.jackson.annotation.JsonIdentityInfo;
-import com.voodoodyne.jackson.jsog.JSOGGenerator;
-
-import lombok.NoArgsConstructor;
-
-@Entity(name = "post")
-@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
-@DiscriminatorColumn(name = "post_type", discriminatorType = DiscriminatorType.STRING)
-@JsonIdentityInfo(generator = JSOGGenerator.class)
-@NoArgsConstructor
-public class Post {
-
-    @Id
-    @GeneratedValue(strategy = GenerationType.IDENTITY)
-    @Column(name = "id")
-    private Long postId;
-
-    @Column(name = "title")
-    private String title;
-
-    @Column(name = "content", columnDefinition = "TEXT")
-    private String content;
-
-    @ManyToOne
-    @JoinColumn(name = "custom_user_details_id")
-    private CustomUserDetails author;
-
-    @Column(name = "time_posted")
-    private LocalDateTime timePosted;
-
-    @Column(name = "time_last_edited")
-    private LocalDateTime timeLastEdited;
-
-    @ManyToOne
-    @JoinColumn(name = "parent_post_id", nullable = true)
-    private Post parent;
-
-    @OneToMany(mappedBy = "parent", cascade = CascadeType.ALL)
-    private List<Post> children = new ArrayList<>();
-
-    @ManyToMany(mappedBy = "likedPosts")
-    Set<CustomUserDetails> likes;
-
-    @ManyToMany(mappedBy = "dislikedPosts")
-    Set<CustomUserDetails> dislikes;
-
-    // getters and setters
-    public Long getPostId() {
-        return postId;
-    }
-
-    public void setPostId(Long postId) {
-        this.postId = postId;
-    }
-
-    public String getTitle() {
-        return title;
-    }
-
-    public void setTitle(String title) {
-        this.title = title;
-    }
-
-    public String getContent() {
-        return content;
-    }
-
-    public void setContent(String content) {
-        this.content = content;
-    }
-
-    public CustomUserDetails getAuthor() {
-        return author;
-    }
-
-    public void setAuthor(CustomUserDetails author) {
-        this.author = author;
-    }
-
-    public LocalDateTime getTimePosted() {
-        return timePosted;
-    }
-
-    public void setTimePosted(LocalDateTime timePosted) {
-        this.timePosted = timePosted;
-    }
-
-    public LocalDateTime getTimeLastEdited() {
-        return timeLastEdited;
-    }
-
-    public void setTimeLastEdited(LocalDateTime timeLastEdited) {
-        this.timeLastEdited = timeLastEdited;
-    }
-
-    public Post getParent() {
-        return parent;
-    }
-
-    public void setParent(Post parent) {
-        this.parent = parent;
-    }
-
-    public List<Post> getChildren() {
-        return children;
-    }
-
-    public void setChildren(List<Post> children) {
-        this.children = children;
-    }
-
-    public Set<CustomUserDetails> getLikes() {
-        return likes;
-    }
-
-    public void setLikes(Set<CustomUserDetails> likes) {
-        this.likes = likes;
-    }
-
-    public Set<CustomUserDetails> getDislikes() {
-        return dislikes;
-    }
-
-    public void setDislikes(Set<CustomUserDetails> dislikes) {
-        this.dislikes = dislikes;
-    }
-
-    // konstruktor so parent (koga e reply)
-    public Post(String title, String content, CustomUserDetails author, LocalDateTime timePosted,
-            LocalDateTime timeLastEdited,
-            Post parent, List<Post> children) {
-        this.title = title;
-        this.content = content;
-        this.author = author;
-        this.timePosted = LocalDateTime.now();
-        this.timeLastEdited = LocalDateTime.now();
-        this.parent = parent;
-        this.children = new ArrayList<>();
-    }
-
-    // konstruktor bez parent (koga NE e reply)
-    public Post(String title, String content, CustomUserDetails author, LocalDateTime timePosted,
-            LocalDateTime timeLastEdited,
-            List<Post> children) {
-        this.title = title;
-        this.content = content;
-        this.author = author;
-        this.timePosted = LocalDateTime.now();
-        this.timeLastEdited = LocalDateTime.now();
-        this.parent = null;
-        this.children = new ArrayList<>();
-    }
-
-}
Index: springapp/src/main/java/mk/profesori/springapp/Model/Professor.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Model/Professor.java	(revision ebc51762bbd1b4345d8908789af87bdc49aad058)
+++ springapp/src/main/java/mk/profesori/springapp/Model/Professor.java	(revision 9506ca8f1d1d14c1a16be0d016d016240b436344)
@@ -1,7 +1,7 @@
 package mk.profesori.springapp.Model;
 
-import java.util.ArrayList;
-import java.util.List;
-import javax.persistence.CascadeType;
+import java.util.HashSet;
+import java.util.Set;
+
 import javax.persistence.Column;
 import javax.persistence.Entity;
@@ -14,10 +14,8 @@
 import javax.persistence.Table;
 
-import com.fasterxml.jackson.annotation.JsonIdentityInfo;
-import com.voodoodyne.jackson.jsog.JSOGGenerator;
+import com.fasterxml.jackson.annotation.JsonBackReference;
 
 @Entity
 @Table(name = "professor")
-@JsonIdentityInfo(generator = JSOGGenerator.class)
 public class Professor {
 
@@ -34,8 +32,5 @@
     private Faculty faculty;
 
-    @OneToMany(mappedBy = "targetProfessor", cascade = CascadeType.ALL)
-    private List<Opinion> relatedOpinions = new ArrayList<Opinion>();
-
-    // getters
+    //getters
     public Long getProfessorId() {
         return professorId;
@@ -46,10 +41,7 @@
     }
 
+    @JsonBackReference
     public Faculty getFaculty() {
         return faculty;
     }
-
-    public List<Opinion> getRelatedOpinions() {
-        return relatedOpinions;
-    }
 }
Index: springapp/src/main/java/mk/profesori/springapp/Model/RegistrationRequest.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Model/RegistrationRequest.java	(revision ebc51762bbd1b4345d8908789af87bdc49aad058)
+++ 	(revision )
@@ -1,17 +1,0 @@
-package mk.profesori.springapp.Model;
-
-import lombok.AllArgsConstructor;
-import lombok.EqualsAndHashCode;
-import lombok.Getter;
-import lombok.ToString;
-
-@Getter
-@AllArgsConstructor
-@EqualsAndHashCode
-@ToString
-public class RegistrationRequest {
-    private final String fullName; //formata treba da dozvoli ova da prazno
-    private final String username;
-    private final String email;
-    private final String password;
-}
Index: springapp/src/main/java/mk/profesori/springapp/Model/Section.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Model/Section.java	(revision ebc51762bbd1b4345d8908789af87bdc49aad058)
+++ 	(revision )
@@ -1,69 +1,0 @@
-package mk.profesori.springapp.Model;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.OneToMany;
-import javax.persistence.OneToOne;
-
-import com.fasterxml.jackson.annotation.JsonIdentityInfo;
-import com.fasterxml.jackson.annotation.ObjectIdGenerators;
-
-@Entity
-@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "sectionId")
-public class Section {
-
-    @Id
-    @GeneratedValue(strategy = GenerationType.IDENTITY)
-    @Column(name = "id")
-    private Long sectionId;
-
-    @Column(name = "name")
-    private String name;
-
-    @OneToMany(mappedBy = "parentSection", cascade = CascadeType.ALL)
-    private List<_Thread> threads = new ArrayList<>();
-
-    @OneToOne
-    @JoinColumn(name = "study_programme_id", referencedColumnName = "id")
-    private StudyProgramme relatedStudyProgramme;
-
-    // getters and setters
-    public Long getSectionId() {
-        return sectionId;
-    }
-
-    public void setSectionId(Long sectionId) {
-        this.sectionId = sectionId;
-    }
-
-    public List<_Thread> getThreads() {
-        return threads;
-    }
-
-    public void setThreads(List<_Thread> threads) {
-        this.threads = threads;
-    }
-
-    public StudyProgramme getRelatedStudyProgramme() {
-        return relatedStudyProgramme;
-    }
-
-    public void setRelatedStudyProgramme(StudyProgramme relatedStudyProgramme) {
-        this.relatedStudyProgramme = relatedStudyProgramme;
-    }
-
-    public Section(Long sectionId, List<_Thread> threads, StudyProgramme relatedStudyProgramme) {
-        this.sectionId = sectionId;
-        this.threads = threads;
-        this.relatedStudyProgramme = relatedStudyProgramme;
-    }
-
-}
Index: springapp/src/main/java/mk/profesori/springapp/Model/StudyProgramme.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Model/StudyProgramme.java	(revision ebc51762bbd1b4345d8908789af87bdc49aad058)
+++ springapp/src/main/java/mk/profesori/springapp/Model/StudyProgramme.java	(revision 9506ca8f1d1d14c1a16be0d016d016240b436344)
@@ -12,13 +12,11 @@
 import javax.persistence.ManyToOne;
 import javax.persistence.OneToMany;
-import javax.persistence.OneToOne;
 import javax.persistence.Table;
 
-import com.fasterxml.jackson.annotation.JsonIdentityInfo;
-import com.fasterxml.jackson.annotation.ObjectIdGenerators;
+import com.fasterxml.jackson.annotation.JsonBackReference;
+import com.fasterxml.jackson.annotation.JsonManagedReference;
 
 @Entity
 @Table(name = "study_programme")
-@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "studyProgrammeId")
 public class StudyProgramme {
 
@@ -31,7 +29,4 @@
     private String studyProgrammeName;
 
-    @Column(name = "cycle")
-    private int cycle;
-
     @ManyToOne
     @JoinColumn(name = "faculty_id")
@@ -41,8 +36,5 @@
     private Set<Subject> subjects = new HashSet<>();
 
-    @OneToOne(mappedBy = "relatedStudyProgramme")
-    private Section relatedSection;
-
-    // getters
+    //getters
     public Long getStudyProgrammeId() {
         return studyProgrammeId;
@@ -53,18 +45,12 @@
     }
 
-    public int getCycle() {
-        return cycle;
-    }
-
+    @JsonBackReference
     public Faculty getFaculty() {
         return faculty;
     }
 
+    @JsonManagedReference
     public Set<Subject> getSubjects() {
         return subjects;
     }
-
-    public Section getRelatedSection() {
-        return relatedSection;
-    }
 }
Index: springapp/src/main/java/mk/profesori/springapp/Model/Subject.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Model/Subject.java	(revision ebc51762bbd1b4345d8908789af87bdc49aad058)
+++ springapp/src/main/java/mk/profesori/springapp/Model/Subject.java	(revision 9506ca8f1d1d14c1a16be0d016d016240b436344)
@@ -1,7 +1,7 @@
 package mk.profesori.springapp.Model;
 
-import java.util.ArrayList;
-import java.util.List;
-import javax.persistence.CascadeType;
+import java.util.HashSet;
+import java.util.Set;
+
 import javax.persistence.Column;
 import javax.persistence.Entity;
@@ -14,10 +14,8 @@
 import javax.persistence.Table;
 
-import com.fasterxml.jackson.annotation.JsonIdentityInfo;
-import com.fasterxml.jackson.annotation.ObjectIdGenerators;
+import com.fasterxml.jackson.annotation.JsonBackReference;
 
 @Entity
 @Table(name = "subject")
-@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "subjectId")
 public class Subject {
 
@@ -34,8 +32,5 @@
     private StudyProgramme studyProgramme;
 
-    @OneToMany(mappedBy = "targetSubject", cascade = CascadeType.ALL)
-    private List<_Thread> threads = new ArrayList<>();
-
-    // getters
+    //getters
     public Long getSubjectId() {
         return subjectId;
@@ -46,11 +41,8 @@
     }
 
+    @JsonBackReference
     public StudyProgramme getStudyProgramme() {
         return studyProgramme;
     }
-
-    public List<_Thread> getThreads() {
-        return threads;
-    }
-
+    
 }
Index: springapp/src/main/java/mk/profesori/springapp/Model/University.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Model/University.java	(revision ebc51762bbd1b4345d8908789af87bdc49aad058)
+++ springapp/src/main/java/mk/profesori/springapp/Model/University.java	(revision 9506ca8f1d1d14c1a16be0d016d016240b436344)
@@ -14,10 +14,9 @@
 import javax.persistence.Table;
 
-import com.fasterxml.jackson.annotation.JsonIdentityInfo;
-import com.fasterxml.jackson.annotation.ObjectIdGenerators;
+import com.fasterxml.jackson.annotation.JsonBackReference;
+import com.fasterxml.jackson.annotation.JsonManagedReference;
 
 @Entity
-@Table(name = "university")
-@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "universityId")
+@Table(name="university")
 public class University {
 
@@ -37,5 +36,5 @@
     private Set<Faculty> faculties = new HashSet<>();
 
-    // getters
+    //getters
     public Long getUniversityId() {
         return universityId;
@@ -46,11 +45,13 @@
     }
 
+    @JsonBackReference
     public City getCity() {
         return city;
     }
 
+    @JsonManagedReference
     public Set<Faculty> getFaculties() {
         return faculties;
     }
-
+    
 }
Index: springapp/src/main/java/mk/profesori/springapp/Model/UserRole.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Model/UserRole.java	(revision ebc51762bbd1b4345d8908789af87bdc49aad058)
+++ 	(revision )
@@ -1,6 +1,0 @@
-package mk.profesori.springapp.Model;
-
-public enum UserRole {
-    REGULAR,
-    MODERATOR
-}
Index: springapp/src/main/java/mk/profesori/springapp/Model/_Thread.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Model/_Thread.java	(revision ebc51762bbd1b4345d8908789af87bdc49aad058)
+++ 	(revision )
@@ -1,53 +1,0 @@
-package mk.profesori.springapp.Model;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.persistence.Column;
-import javax.persistence.DiscriminatorValue;
-import javax.persistence.ElementCollection;
-import javax.persistence.Entity;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-
-@Entity
-@DiscriminatorValue("thread")
-public class _Thread extends Post {
-
-    @Column(name = "tags")
-    @ElementCollection
-    private List<String> tags = new ArrayList<>();
-
-    @ManyToOne
-    @JoinColumn(name = "section_id")
-    private Section parentSection;
-
-    @ManyToOne
-    @JoinColumn(name = "subject_id")
-    private Subject targetSubject;
-
-    // TODO threadovi
-    /*
-     * public _Thread(String title, String content, List<String> tags, Section
-     * parentSection, Subject targetSubject) {
-     * super(title, content);
-     * this.tags = tags;
-     * this.parentSection = parentSection;
-     * this.targetSubject = targetSubject;
-     * }
-     */
-
-    // getters
-    public List<String> getTags() {
-        return tags;
-    }
-
-    public Section getParentSection() {
-        return parentSection;
-    }
-
-    public Subject getTargetSubject() {
-        return targetSubject;
-    }
-
-}
Index: springapp/src/main/java/mk/profesori/springapp/Repository/CityRepository.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Repository/CityRepository.java	(revision ebc51762bbd1b4345d8908789af87bdc49aad058)
+++ springapp/src/main/java/mk/profesori/springapp/Repository/CityRepository.java	(revision 9506ca8f1d1d14c1a16be0d016d016240b436344)
@@ -4,9 +4,7 @@
 
 import org.springframework.data.repository.CrudRepository;
-import org.springframework.stereotype.Repository;
 
 import mk.profesori.springapp.Model.City;
 
-@Repository
 public interface CityRepository extends CrudRepository<City, Long>{
 
Index: springapp/src/main/java/mk/profesori/springapp/Repository/ConfirmationTokenRepository.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Repository/ConfirmationTokenRepository.java	(revision ebc51762bbd1b4345d8908789af87bdc49aad058)
+++ 	(revision )
@@ -1,24 +1,0 @@
-package mk.profesori.springapp.Repository;
-
-import java.time.LocalDateTime;
-import java.util.Optional;
-
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.Modifying;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.stereotype.Repository;
-import org.springframework.transaction.annotation.Transactional;
-
-import mk.profesori.springapp.Model.ConfirmationToken;
-
-@Repository
-@Transactional(readOnly = true)
-public interface ConfirmationTokenRepository extends JpaRepository<ConfirmationToken,Long>{
-    
-    Optional<ConfirmationToken> findByToken(String token);
-
-    @Transactional
-    @Modifying
-    @Query("UPDATE ConfirmationToken c " + "SET c.confirmedAt = ?2 " + "WHERE c.token = ?1")
-    int updateConfirmedAt(String token, LocalDateTime confirmedAt);
-}
Index: springapp/src/main/java/mk/profesori/springapp/Repository/FacultyRepository.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Repository/FacultyRepository.java	(revision ebc51762bbd1b4345d8908789af87bdc49aad058)
+++ springapp/src/main/java/mk/profesori/springapp/Repository/FacultyRepository.java	(revision 9506ca8f1d1d14c1a16be0d016d016240b436344)
@@ -4,10 +4,8 @@
 
 import org.springframework.data.repository.CrudRepository;
-import org.springframework.stereotype.Repository;
 
 import mk.profesori.springapp.Model.Faculty;
 import mk.profesori.springapp.Model.University;
 
-@Repository
 public interface FacultyRepository extends CrudRepository<Faculty, Long>{
 
Index: springapp/src/main/java/mk/profesori/springapp/Repository/OpinionRepository.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Repository/OpinionRepository.java	(revision ebc51762bbd1b4345d8908789af87bdc49aad058)
+++ 	(revision )
@@ -1,11 +1,0 @@
-package mk.profesori.springapp.Repository;
-
-import org.springframework.data.repository.CrudRepository;
-import org.springframework.stereotype.Repository;
-
-import mk.profesori.springapp.Model.Opinion;
-
-@Repository
-public interface OpinionRepository extends CrudRepository<Opinion, Long> {
-    public Opinion findByPostId(Long id);
-}
Index: springapp/src/main/java/mk/profesori/springapp/Repository/ProfessorRepository.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Repository/ProfessorRepository.java	(revision ebc51762bbd1b4345d8908789af87bdc49aad058)
+++ springapp/src/main/java/mk/profesori/springapp/Repository/ProfessorRepository.java	(revision 9506ca8f1d1d14c1a16be0d016d016240b436344)
@@ -3,20 +3,13 @@
 import java.util.List;
 
-import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 import org.springframework.data.repository.CrudRepository;
-import org.springframework.stereotype.Repository;
 
 import mk.profesori.springapp.Model.Faculty;
 import mk.profesori.springapp.Model.Professor;
 
-@Repository
-public interface ProfessorRepository extends CrudRepository<Professor, Long>, JpaSpecificationExecutor<Professor> {
-
+public interface ProfessorRepository extends CrudRepository<Professor, Long>{
+    
     public List<Professor> findAll();
-
     public Professor findByProfessorId(Long id);
-
     public List<Professor> findByFaculty(Faculty faculty);
-
-    public List<Professor> findByProfessorNameContainingIgnoreCase(String name);
 }
Index: springapp/src/main/java/mk/profesori/springapp/Repository/StudyProgrammeRepository.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Repository/StudyProgrammeRepository.java	(revision ebc51762bbd1b4345d8908789af87bdc49aad058)
+++ 	(revision )
@@ -1,18 +1,0 @@
-package mk.profesori.springapp.Repository;
-
-import java.util.List;
-
-import org.springframework.data.repository.CrudRepository;
-import org.springframework.stereotype.Repository;
-
-import mk.profesori.springapp.Model.Faculty;
-import mk.profesori.springapp.Model.StudyProgramme;
-
-
-@Repository
-public interface StudyProgrammeRepository extends CrudRepository<StudyProgramme, Long>{
-    
-    public List<StudyProgramme> findAll();
-    public StudyProgramme findByStudyProgrammeId(Long id);
-    public List<StudyProgramme> findByFaculty(Faculty faculty);
-}
Index: springapp/src/main/java/mk/profesori/springapp/Repository/UniversityRepository.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Repository/UniversityRepository.java	(revision ebc51762bbd1b4345d8908789af87bdc49aad058)
+++ springapp/src/main/java/mk/profesori/springapp/Repository/UniversityRepository.java	(revision 9506ca8f1d1d14c1a16be0d016d016240b436344)
@@ -4,16 +4,13 @@
 
 import org.springframework.data.repository.CrudRepository;
-import org.springframework.stereotype.Repository;
 
 import mk.profesori.springapp.Model.City;
+import mk.profesori.springapp.Model.Faculty;
 import mk.profesori.springapp.Model.University;
 
-@Repository
-public interface UniversityRepository extends CrudRepository<University, Long> {
+public interface UniversityRepository extends CrudRepository<University, Long>{
 
     public List<University> findAll();
-
     public University findByUniversityId(Long id);
-
     public List<University> findByCity(City city);
 }
Index: springapp/src/main/java/mk/profesori/springapp/Repository/UserRepository.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Repository/UserRepository.java	(revision ebc51762bbd1b4345d8908789af87bdc49aad058)
+++ 	(revision )
@@ -1,23 +1,0 @@
-package mk.profesori.springapp.Repository;
-
-import java.util.Optional;
-
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.Modifying;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.stereotype.Repository;
-import org.springframework.transaction.annotation.Transactional;
-
-import mk.profesori.springapp.Model.CustomUserDetails;
-
-@Repository
-@Transactional(readOnly = true)
-public interface UserRepository extends JpaRepository<CustomUserDetails,Long> {
-    Optional<CustomUserDetails> findByEmail(String email);
-    Optional<CustomUserDetails> findByUsername(String username);
-
-    @Transactional
-    @Modifying
-    @Query("UPDATE CustomUserDetails a " + "SET a.enabled = TRUE WHERE a.email = ?1")
-    int enableUser(String email);
-}
Index: springapp/src/main/java/mk/profesori/springapp/Security/CustomAuthenticationSuccessHandler.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Security/CustomAuthenticationSuccessHandler.java	(revision ebc51762bbd1b4345d8908789af87bdc49aad058)
+++ 	(revision )
@@ -1,79 +1,0 @@
-package mk.profesori.springapp.Security;
-
-import java.io.IOException;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.springframework.security.core.Authentication;
-import org.springframework.security.core.GrantedAuthority;
-import org.springframework.security.web.DefaultRedirectStrategy;
-import org.springframework.security.web.RedirectStrategy;
-import org.springframework.security.web.WebAttributes;
-import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
-
-public class CustomAuthenticationSuccessHandler
-    implements AuthenticationSuccessHandler {
-
-  protected Log logger = LogFactory.getLog(this.getClass());
-
-  private RedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
-
-  @Override
-  public void onAuthenticationSuccess(HttpServletRequest request,
-      HttpServletResponse response, Authentication authentication)
-      throws IOException {
-
-    handle(request, response, authentication);
-    clearAuthenticationAttributes(request);
-  }
-
-  protected void handle(
-      HttpServletRequest request,
-      HttpServletResponse response,
-      Authentication authentication) throws IOException {
-
-    String targetUrl = determineTargetUrl(authentication, request.getSession().getId());
-
-    if (response.isCommitted()) {
-      logger.debug(
-          "Response has already been committed. Unable to redirect to "
-              + targetUrl);
-      return;
-    }
-
-    redirectStrategy.sendRedirect(request, response, targetUrl);
-  }
-
-  protected String determineTargetUrl(final Authentication authentication, String sessionId) {
-
-    Map<String, String> roleTargetUrlMap = new HashMap<>();
-    roleTargetUrlMap.put("REGULAR", "/public/loginSuccessRegular?sessionId=" + sessionId);
-    roleTargetUrlMap.put("MODERATOR", "/public/loginSuccessModerator?sessionId=" + sessionId);
-
-    final Collection<? extends GrantedAuthority> authorities = authentication.getAuthorities();
-    for (final GrantedAuthority grantedAuthority : authorities) {
-      String authorityName = grantedAuthority.getAuthority();
-      if (roleTargetUrlMap.containsKey(authorityName)) {
-        return roleTargetUrlMap.get(authorityName);
-      }
-    }
-
-    throw new IllegalStateException();
-  }
-
-  protected void clearAuthenticationAttributes(HttpServletRequest request) {
-    HttpSession session = request.getSession(false);
-    if (session == null) {
-      return;
-    }
-    session.removeAttribute(WebAttributes.AUTHENTICATION_EXCEPTION);
-  }
-
-}
Index: springapp/src/main/java/mk/profesori/springapp/Security/SecurityConfiguration.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Security/SecurityConfiguration.java	(revision ebc51762bbd1b4345d8908789af87bdc49aad058)
+++ 	(revision )
@@ -1,67 +1,0 @@
-package mk.profesori.springapp.Security;
-
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.security.authentication.AuthenticationManager;
-import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration;
-import org.springframework.security.config.annotation.web.builders.HttpSecurity;
-import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
-import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
-import org.springframework.security.crypto.password.PasswordEncoder;
-import org.springframework.security.web.SecurityFilterChain;
-import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
-import org.springframework.web.servlet.config.annotation.CorsRegistry;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
-
-import lombok.RequiredArgsConstructor;
-
-@Configuration
-@RequiredArgsConstructor
-@EnableWebSecurity
-public class SecurityConfiguration {
-
-    @Bean
-    public PasswordEncoder passwordEncoder() {
-        return new BCryptPasswordEncoder();
-    }
-
-    @Bean
-    public AuthenticationManager authenticationManager(AuthenticationConfiguration authenticationConfiguration)
-            throws Exception {
-        return authenticationConfiguration.getAuthenticationManager();
-    }
-
-    @Bean
-    public WebMvcConfigurer corsConfigurer() {
-        return new WebMvcConfigurer() {
-            @Override
-            public void addCorsMappings(CorsRegistry registry) {
-                registry.addMapping("/**").allowedOrigins("http://192.168.0.17:3000", "http://192.168.0.24:3000")
-                        .allowCredentials(true);
-            }
-        };
-    }
-
-    @Bean
-    public AuthenticationSuccessHandler customAuthenticationSuccessHandler() {
-        return new CustomAuthenticationSuccessHandler();
-    }
-
-    @Bean
-    protected SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
-        http
-                .httpBasic() // neenkriptirani credentials osven ako ne e preky https/tls
-                .and()
-                .cors()
-                .and()
-                .csrf().disable() // PRIVREMENO
-                .authorizeRequests()
-                .antMatchers("/secure/**").hasAnyAuthority("REGULAR", "MODERATOR")
-                .antMatchers("/public/**").permitAll()
-                .antMatchers("/registration/**").permitAll()
-                .and()
-                .formLogin().successHandler(customAuthenticationSuccessHandler());
-
-        return http.build();
-    }
-}
Index: springapp/src/main/java/mk/profesori/springapp/Service/ConfirmationTokenService.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Service/ConfirmationTokenService.java	(revision ebc51762bbd1b4345d8908789af87bdc49aad058)
+++ 	(revision )
@@ -1,31 +1,0 @@
-package mk.profesori.springapp.Service;
-
-import java.time.LocalDateTime;
-import java.util.Optional;
-
-import org.springframework.stereotype.Service;
-
-import lombok.AllArgsConstructor;
-import mk.profesori.springapp.Model.ConfirmationToken;
-import mk.profesori.springapp.Repository.ConfirmationTokenRepository;
-
-@Service
-@AllArgsConstructor
-public class ConfirmationTokenService {
-
-    private final ConfirmationTokenRepository confirmationTokenRepository;
-
-    public void saveConfirmationToken(ConfirmationToken token) {
-        confirmationTokenRepository.save(token);
-    }
-
-    public Optional<ConfirmationToken> getToken(String token) {
-        return confirmationTokenRepository.findByToken(token);
-    }
-
-    public int setConfirmedAt(String token) {
-        return confirmationTokenRepository.updateConfirmedAt(
-                token, LocalDateTime.now());
-    }
-
-}
Index: springapp/src/main/java/mk/profesori/springapp/Service/CustomUserDetailsService.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Service/CustomUserDetailsService.java	(revision ebc51762bbd1b4345d8908789af87bdc49aad058)
+++ 	(revision )
@@ -1,65 +1,0 @@
-package mk.profesori.springapp.Service;
-
-import java.time.LocalDateTime;
-import java.util.UUID;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.core.userdetails.UserDetails;
-import org.springframework.security.core.userdetails.UserDetailsService;
-import org.springframework.security.core.userdetails.UsernameNotFoundException;
-import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
-import org.springframework.security.crypto.password.PasswordEncoder;
-import org.springframework.stereotype.Service;
-
-import lombok.AllArgsConstructor;
-import mk.profesori.springapp.Model.ConfirmationToken;
-import mk.profesori.springapp.Model.CustomUserDetails;
-import mk.profesori.springapp.Repository.UserRepository;
-
-@Service
-@AllArgsConstructor
-public class CustomUserDetailsService implements UserDetailsService {
-
-    private final UserRepository userRepository;
-
-    @Autowired
-    public PasswordEncoder passwordEncoder() {
-        return new BCryptPasswordEncoder();
-    }
-
-    private final static String USER_NOT_FOUND_MSG = "User with email %s not found";
-    private final ConfirmationTokenService confirmationTokenService;
-
-    @Override
-    public UserDetails loadUserByUsername(String email) throws UsernameNotFoundException {
-        return userRepository.findByEmail(email).orElseThrow(
-                () -> new UsernameNotFoundException(String.format(USER_NOT_FOUND_MSG, email)));
-    }
-
-    public String signUp(CustomUserDetails customUserDetails) {
-        String encodedPassword = passwordEncoder().encode(customUserDetails.getPassword());
-        customUserDetails.setPassword(encodedPassword);
-
-        userRepository.save(customUserDetails);
-
-        String token = createToken(customUserDetails);
-
-        return token;
-    }
-
-    public String createToken(CustomUserDetails customUserDetails) {
-        String token = UUID.randomUUID().toString();
-        ConfirmationToken confirmationToken = new ConfirmationToken(
-                token,
-                LocalDateTime.now(),
-                LocalDateTime.now().plusMinutes(10),
-                customUserDetails);
-
-        confirmationTokenService.saveConfirmationToken(confirmationToken);
-        return token;
-    }
-
-    public int enableUser(String email) {
-        return userRepository.enableUser(email);
-    }
-}
Index: springapp/src/main/java/mk/profesori/springapp/Service/EmailSender.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Service/EmailSender.java	(revision ebc51762bbd1b4345d8908789af87bdc49aad058)
+++ 	(revision )
@@ -1,6 +1,0 @@
-package mk.profesori.springapp.Service;
-
-public interface EmailSender {
-    void send(String to, String email);
-    String buildEmail(String username, String link);
-}
Index: springapp/src/main/java/mk/profesori/springapp/Service/EmailService.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Service/EmailService.java	(revision ebc51762bbd1b4345d8908789af87bdc49aad058)
+++ 	(revision )
@@ -1,109 +1,0 @@
-package mk.profesori.springapp.Service;
-
-import javax.mail.MessagingException;
-import javax.mail.internet.MimeMessage;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.mail.javamail.JavaMailSender;
-import org.springframework.mail.javamail.MimeMessageHelper;
-import org.springframework.scheduling.annotation.Async;
-import org.springframework.stereotype.Service;
-
-import lombok.AllArgsConstructor;
-
-@Service
-@AllArgsConstructor
-public class EmailService implements EmailSender{
-    
-    private final static Logger LOGGER = LoggerFactory.getLogger(EmailService.class);
-    private final JavaMailSender mailSender;
-
-    @Override
-    @Async
-    public void send(String to, String email) {
-        try {
-            MimeMessage mimeMessage = mailSender.createMimeMessage();
-            MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, "utf-8");
-            helper.setText(email, true);
-            helper.setTo(to);
-            helper.setSubject("Активирај ја својата корисничка сметка");
-            helper.setFrom("admin@profesori.mk");
-            mailSender.send(mimeMessage);
-        } catch (MessagingException e) {
-            LOGGER.error("Failed to send email", e);
-            throw new IllegalStateException("Failed to send email");
-        }
-    }
-
-    @Override
-    public String buildEmail(String username, String link) {
-        return "<div style=\"font-family:Helvetica,Arial,sans-serif;font-size:16px;margin:0;color:#0b0c0c\">\n" +
-                "\n" +
-                "<span style=\"display:none;font-size:1px;color:#fff;max-height:0\"></span>\n" +
-                "\n" +
-                "  <table role=\"presentation\" width=\"100%\" style=\"border-collapse:collapse;min-width:100%;width:100%!important\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n" +
-                "    <tbody><tr>\n" +
-                "      <td width=\"100%\" height=\"53\" bgcolor=\"#0b0c0c\">\n" +
-                "        \n" +
-                "        <table role=\"presentation\" width=\"100%\" style=\"border-collapse:collapse;max-width:580px\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" align=\"center\">\n" +
-                "          <tbody><tr>\n" +
-                "            <td width=\"70\" bgcolor=\"#0b0c0c\" valign=\"middle\">\n" +
-                "                <table role=\"presentation\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border-collapse:collapse\">\n" +
-                "                  <tbody><tr>\n" +
-                "                    <td style=\"padding-left:10px\">\n" +
-                "                  \n" +
-                "                    </td>\n" +
-                "                    <td style=\"font-size:28px;line-height:1.315789474;Margin-top:4px;padding-left:10px\">\n" +
-                "                      <span style=\"font-family:Helvetica,Arial,sans-serif;font-weight:700;color:#ffffff;text-decoration:none;vertical-align:top;display:inline-block\">Активирај ја својата корисничка сметка</span>\n" +
-                "                    </td>\n" +
-                "                  </tr>\n" +
-                "                </tbody></table>\n" +
-                "              </a>\n" +
-                "            </td>\n" +
-                "          </tr>\n" +
-                "        </tbody></table>\n" +
-                "        \n" +
-                "      </td>\n" +
-                "    </tr>\n" +
-                "  </tbody></table>\n" +
-                "  <table role=\"presentation\" class=\"m_-6186904992287805515content\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border-collapse:collapse;max-width:580px;width:100%!important\" width=\"100%\">\n" +
-                "    <tbody><tr>\n" +
-                "      <td width=\"10\" height=\"10\" valign=\"middle\"></td>\n" +
-                "      <td>\n" +
-                "        \n" +
-                "                <table role=\"presentation\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border-collapse:collapse\">\n" +
-                "                  <tbody><tr>\n" +
-                "                    <td bgcolor=\"#1D70B8\" width=\"100%\" height=\"10\"></td>\n" +
-                "                  </tr>\n" +
-                "                </tbody></table>\n" +
-                "        \n" +
-                "      </td>\n" +
-                "      <td width=\"10\" valign=\"middle\" height=\"10\"></td>\n" +
-                "    </tr>\n" +
-                "  </tbody></table>\n" +
-                "\n" +
-                "\n" +
-                "\n" +
-                "  <table role=\"presentation\" class=\"m_-6186904992287805515content\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border-collapse:collapse;max-width:580px;width:100%!important\" width=\"100%\">\n" +
-                "    <tbody><tr>\n" +
-                "      <td height=\"30\"><br></td>\n" +
-                "    </tr>\n" +
-                "    <tr>\n" +
-                "      <td width=\"10\" valign=\"middle\"><br></td>\n" +
-                "      <td style=\"font-family:Helvetica,Arial,sans-serif;font-size:19px;line-height:1.315789474;max-width:560px\">\n" +
-                "        \n" +
-                "            <p style=\"Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c\">Здраво " + username + ",</p><p style=\"Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c\"> Добредојде на profesori.mk!. Да ја активираш својата корисничка сметка, кликни на линкот долу: </p><blockquote style=\"Margin:0 0 20px 0;border-left:10px solid #b1b4b6;padding:15px 0 0.1px 15px;font-size:19px;line-height:25px\"><p style=\"Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c\"> <a href=\"" + link + "\">Активирај</a> </p></blockquote>\n Линкот истекува за 10 минути. <p>Убав престој!</p>" +
-                "        \n" +
-                "      </td>\n" +
-                "      <td width=\"10\" valign=\"middle\"><br></td>\n" +
-                "    </tr>\n" +
-                "    <tr>\n" +
-                "      <td height=\"30\"><br></td>\n" +
-                "    </tr>\n" +
-                "  </tbody></table><div class=\"yj6qo\"></div><div class=\"adL\">\n" +
-                "\n" +
-                "</div></div>";
-    }
-
-}
Index: springapp/src/main/java/mk/profesori/springapp/Service/EmailValidator.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Service/EmailValidator.java	(revision ebc51762bbd1b4345d8908789af87bdc49aad058)
+++ 	(revision )
@@ -1,27 +1,0 @@
-package mk.profesori.springapp.Service;
-
-import java.util.function.Predicate;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.springframework.stereotype.Service;
-
-@Service
-public class EmailValidator implements Predicate<String> {
-    
-    @Override
-    public boolean test(String email) {
-        
-        String regex = "^(.+)@(.+)$";
-
-        Pattern pattern = Pattern.compile(regex);
-
-        if (email == null) {
-            return false;
-        }
-
-        Matcher matcher = pattern.matcher(email);
-
-        return matcher.matches();   
-    }
-}
Index: springapp/src/main/java/mk/profesori/springapp/Service/MainService.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Service/MainService.java	(revision ebc51762bbd1b4345d8908789af87bdc49aad058)
+++ springapp/src/main/java/mk/profesori/springapp/Service/MainService.java	(revision 9506ca8f1d1d14c1a16be0d016d016240b436344)
@@ -9,24 +9,16 @@
 import mk.profesori.springapp.Repository.CityRepository;
 import mk.profesori.springapp.Repository.FacultyRepository;
-import mk.profesori.springapp.Repository.OpinionRepository;
 import mk.profesori.springapp.Repository.ProfessorRepository;
-import mk.profesori.springapp.Repository.StudyProgrammeRepository;
 import mk.profesori.springapp.Repository.UniversityRepository;
-import mk.profesori.springapp.Repository.UserRepository;
 import mk.profesori.springapp.Model.City;
-import mk.profesori.springapp.Model.CustomUserDetails;
 import mk.profesori.springapp.Model.Faculty;
-import mk.profesori.springapp.Model.Opinion;
 import mk.profesori.springapp.Model.Professor;
-import mk.profesori.springapp.Model.StudyProgramme;
 import mk.profesori.springapp.Model.University;
 
-@Service
+@Service        
 public class MainService {
-
+    
     @Autowired
     private ProfessorRepository professorRepository;
-    @Autowired
-    private StudyProgrammeRepository studyProgrammeRepository;
     @Autowired
     private FacultyRepository facultyRepository;
@@ -35,8 +27,4 @@
     @Autowired
     private CityRepository cityRepository;
-    @Autowired
-    private OpinionRepository opinionRepository;
-    @Autowired
-    private UserRepository userRepository;
 
     public List<Professor> getAllProfessors() {
@@ -53,36 +41,9 @@
 
     public List<Professor> getProfessorsByFacultyId(Long facultyId) {
-
+        
         Faculty faculty = facultyRepository.findByFacultyId(facultyId);
 
         List<Professor> list = new ArrayList<>();
         professorRepository.findByFaculty(faculty).forEach(list::add);
-        return list;
-    }
-
-    public List<Professor> getProfessorsByNameContains(String contained) {
-        List<Professor> list = new ArrayList<>();
-        professorRepository.findByProfessorNameContainingIgnoreCase(contained).forEach(list::add);
-        return list;
-    }
-
-    public List<StudyProgramme> getAllStudyProgrammes() {
-
-        List<StudyProgramme> list = new ArrayList<>();
-        studyProgrammeRepository.findAll().forEach(list::add);
-        return list;
-    }
-
-    public StudyProgramme getStudyProgrammeById(Long id) {
-
-        return studyProgrammeRepository.findByStudyProgrammeId(id);
-    }
-
-    public List<StudyProgramme> getStudyProgrammesByFacultyId(Long facultyId) {
-
-        Faculty faculty = facultyRepository.findByFacultyId(facultyId);
-
-        List<StudyProgramme> list = new ArrayList<>();
-        studyProgrammeRepository.findByFaculty(faculty).forEach(list::add);
         return list;
     }
@@ -99,5 +60,5 @@
 
     public List<Faculty> getFacultiesByUniversityId(Long universityId) {
-
+        
         University university = universityRepository.findByUniversityId(universityId);
 
@@ -118,5 +79,5 @@
 
     public List<University> getUniversitiesByCityId(Long cityId) {
-
+        
         City city = cityRepository.findByCityId(cityId);
 
@@ -135,58 +96,3 @@
         return cityRepository.findByCityId(id);
     }
-
-    public void addOpinion(String title, String content, Long professorId, CustomUserDetails currentUser) {
-
-        Professor targetProfessor = professorRepository.findByProfessorId(professorId);
-
-        Opinion opinionToAdd = new Opinion(title, content, currentUser, null, null,
-                null, targetProfessor);
-
-        opinionRepository.save(opinionToAdd);
-    }
-
-    public void replyToOpinion(String content, Long professorId, Long postId, CustomUserDetails currentUser) {
-
-        Professor targetProfessor = professorRepository.findByProfessorId(professorId);
-        Opinion targetOpinion = opinionRepository.findByPostId(postId);
-
-        Opinion opinionToAdd = new Opinion(null, content, currentUser, null, null,
-                targetOpinion, null, targetProfessor);
-        opinionRepository.save(opinionToAdd);
-
-        targetOpinion.getChildren().add(opinionToAdd);
-        opinionRepository.save(targetOpinion);
-    }
-
-    public void upvoteOpinion(Long postId, CustomUserDetails currentUser) {
-        Opinion targetOpinion = opinionRepository.findByPostId(postId);
-
-        if (!targetOpinion.getLikes().contains(currentUser)) {
-
-            targetOpinion.getLikes().add(currentUser);
-            // opinionRepository.save(targetOpinion);
-
-            targetOpinion.getAuthor().setKarma(targetOpinion.getAuthor().getKarma() + 1);
-            userRepository.save(targetOpinion.getAuthor());
-
-            currentUser.getLikedPosts().add(targetOpinion);
-            userRepository.save(currentUser);
-        }
-    }
-
-    public void downvoteOpinion(Long postId, CustomUserDetails currentUser) {
-        Opinion targetOpinion = opinionRepository.findByPostId(postId);
-
-        if (!targetOpinion.getDislikes().contains(currentUser)) {
-
-            targetOpinion.getDislikes().add(currentUser);
-            // opinionRepository.save(targetOpinion);
-
-            targetOpinion.getAuthor().setKarma(targetOpinion.getAuthor().getKarma() - 1);
-            userRepository.save(targetOpinion.getAuthor());
-
-            currentUser.getDislikedPosts().add(targetOpinion);
-            userRepository.save(currentUser);
-        }
-    }
 }
Index: springapp/src/main/java/mk/profesori/springapp/Service/PasswordValidator.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Service/PasswordValidator.java	(revision ebc51762bbd1b4345d8908789af87bdc49aad058)
+++ 	(revision )
@@ -1,39 +1,0 @@
-package mk.profesori.springapp.Service;
-
-import java.util.function.Predicate;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.springframework.stereotype.Service;
-
-@Service
-public class PasswordValidator implements Predicate<String> {
-    
-    @Override
-    public boolean test(String password) {
-        
-        String regex = "^(?=.*[0-9])"
-                       + "(?=.*[a-z])(?=.*[A-Z])"
-                       + "(?=.*[@#$%^&+=])"
-                       + "(?=\\S+$).{8,20}$";
-
-        Pattern pattern = Pattern.compile(regex);
-
-        if (password == null) {
-            return false;
-        }
-
-        Matcher matcher = pattern.matcher(password);
-
-        return matcher.matches();   
-    }
-}
-
-/*
-    It contains at least 8 characters and at most 20 characters.
-    It contains at least one digit.
-    It contains at least one upper case alphabet.
-    It contains at least one lower case alphabet.
-    It contains at least one special character which includes !@#$%&*()-+=^.
-    It doesn’t contain any white space.
- */
Index: springapp/src/main/java/mk/profesori/springapp/Service/RegistrationService.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Service/RegistrationService.java	(revision ebc51762bbd1b4345d8908789af87bdc49aad058)
+++ 	(revision )
@@ -1,96 +1,0 @@
-package mk.profesori.springapp.Service;
-
-import java.time.LocalDateTime;
-
-import javax.transaction.Transactional;
-
-import org.springframework.stereotype.Service;
-
-import lombok.AllArgsConstructor;
-import mk.profesori.springapp.Model.ConfirmationToken;
-import mk.profesori.springapp.Model.CustomUserDetails;
-import mk.profesori.springapp.Model.RegistrationRequest;
-import mk.profesori.springapp.Model.UserRole;
-import mk.profesori.springapp.Repository.UserRepository;
-
-@Service
-@AllArgsConstructor
-public class RegistrationService {
-
-    private final CustomUserDetailsService customUserDetailsService;
-    private final ConfirmationTokenService confirmationTokenService;
-    private final EmailValidator emailValidator;
-    private final PasswordValidator passwordValidator;
-    private final UsernameValidator usernameValidator;
-    private final EmailSender emailSender;
-    private final UserRepository userRepository;
-
-    public String register(RegistrationRequest request) {
-
-        boolean isValidEmail = emailValidator.test(request.getEmail());
-        if (!isValidEmail)
-            throw new IllegalStateException("Invalid email");
-
-        boolean isValidPassword = passwordValidator.test(request.getPassword());
-        if (!isValidPassword)
-            throw new IllegalStateException("Invalid password");
-
-        boolean isValidUsername = usernameValidator.test(request.getUsername());
-        if (!isValidUsername)
-            throw new IllegalStateException("Invalid username");
-
-        boolean emailExists = userRepository.findByEmail(request.getEmail()).isPresent();
-        if (emailExists) {
-            if (!userRepository.findByEmail(request.getEmail()).get().isEnabled()) {
-                String tokenToResend = customUserDetailsService
-                        .createToken(userRepository.findByEmail(request.getEmail()).get());
-                String link = "http://192.168.0.17:8080/registration/confirm?token=" + tokenToResend;
-                emailSender.send(request.getEmail(), emailSender.buildEmail(request.getUsername(), link));
-                return tokenToResend;
-            } else {
-                throw new IllegalStateException("Email is taken");
-            }
-        }
-
-        boolean usernameExists = userRepository.findByUsername(request.getUsername()).isPresent();
-        if (usernameExists) {
-            throw new IllegalStateException("Username is taken");
-        }
-
-        String token = customUserDetailsService.signUp(
-                new CustomUserDetails(
-                        request.getFullName(),
-                        request.getUsername(),
-                        request.getEmail(),
-                        request.getPassword(),
-                        UserRole.REGULAR));
-
-        String link = "http://192.168.0.17:8080/registration/confirm?token=" + token;
-
-        emailSender.send(request.getEmail(), emailSender.buildEmail(request.getUsername(), link));
-
-        return token;
-    }
-
-    @Transactional
-    public String confirmToken(String token) {
-        ConfirmationToken confirmationToken = confirmationTokenService
-                .getToken(token)
-                .orElseThrow(() -> new IllegalStateException("Token not found"));
-
-        if (confirmationToken.getConfirmedAt() != null) {
-            throw new IllegalStateException("Email already confirmed");
-        }
-
-        LocalDateTime expiredAt = confirmationToken.getExpiresAt();
-
-        if (expiredAt.isBefore(LocalDateTime.now())) {
-            throw new IllegalStateException("Token expired");
-        }
-
-        confirmationTokenService.setConfirmedAt(token);
-        customUserDetailsService.enableUser(
-                confirmationToken.getCustomUserDetails().getEmail());
-        return "Confirmed";
-    }
-}
Index: springapp/src/main/java/mk/profesori/springapp/Service/UsernameValidator.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Service/UsernameValidator.java	(revision ebc51762bbd1b4345d8908789af87bdc49aad058)
+++ 	(revision )
@@ -1,36 +1,0 @@
-package mk.profesori.springapp.Service;
-
-import java.util.function.Predicate;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.springframework.stereotype.Service;
-
-@Service
-public class UsernameValidator implements Predicate<String> {
-    
-    @Override
-    public boolean test(String username) {
-        
-        String regex = "^[A-Za-z]\\w{5,29}$";
-        
-        Pattern pattern = Pattern.compile(regex);
-
-        if (username == null) {
-            return false;
-        }
-
-        Matcher matcher = pattern.matcher(username);
-
-        return matcher.matches();   
-    }
-}
-
-/*
-  - The username consists of 6 to 30 characters inclusive. If the username
-    consists of less than 6 or greater than 30 characters, then it is an invalid username.
-  - The username can only contain alphanumeric characters and underscores (_). 
-    Alphanumeric characters describe the character set consisting of lowercase characters [a – z], uppercase characters [A – Z], and digits [0 – 9].
-  - The first character of the username must be an alphabetic character, i.e., either lowercase character
-    [a – z] or uppercase character [A – Z].
- */
