Index: springapp/src/main/java/mk/profesori/springapp/Controller/PublicController.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Controller/PublicController.java	(revision af801e3ae2a87e526d2053085fdbb077aafd6741)
+++ springapp/src/main/java/mk/profesori/springapp/Controller/PublicController.java	(revision 9bf1f8db5dd66185ddc4f7d093582ff73006f66b)
@@ -1,3 +1,8 @@
 package mk.profesori.springapp.Controller;
+
+import mk.profesori.springapp.Model.*;
+import mk.profesori.springapp.Service.MainService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.Collections;
@@ -6,24 +11,7 @@
 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.Subject;
-import mk.profesori.springapp.Model.University;
-import mk.profesori.springapp.Model._Thread;
-import mk.profesori.springapp.Service.MainService;
-
 @RestController
 @RequestMapping("/public")
-@CrossOrigin(origins = { "http://192.168.0.29:3000", "http://192.168.0.28:3000" })
+@CrossOrigin(origins = { "http://192.168.1.254:3000", "http://192.168.0.28:3000" })
 public class PublicController {
 
@@ -42,6 +30,11 @@
     @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
+        return mainService.getProfessorsByNameContains(contained); // vrakja profesori sto sodrzat "contained" vo imeto
+
+    }
+
+    @RequestMapping(value = "/subjects/nameContains/{contained}", method = RequestMethod.GET)
+    public List<Subject> getSubjectsByNameContains(@PathVariable String contained) {
+        return mainService.getSubjectsByNameContains(contained); // vrakja predmeti sto sodrzat "contained" vo imeto
     }
 
@@ -49,4 +42,9 @@
     public Professor getProfessorById(@PathVariable Long professorId) {
         return mainService.getProfessorById(professorId); // vrakja profesor spored id
+    }
+
+    @RequestMapping(value="/professor/{professorId}/relatedOpinions", method = RequestMethod.GET)
+    public List<Opinion> getRelatedOpinions(@PathVariable Long professorId) {
+        return mainService.getRelatedOpinions(professorId);
     }
 
@@ -105,4 +103,9 @@
     }
 
+    @RequestMapping(value = "/subjects", method = RequestMethod.GET)
+    public List<Subject> getSubjectsByStudyProgramme(@RequestParam Long studyProgrammeId) {
+        return mainService.getSubjectsByStudyProgramme(studyProgrammeId);
+    }
+
     @RequestMapping(value = "/thread/{postId}", method = RequestMethod.GET)
     public _Thread getThreadById(@PathVariable Long postId) {
@@ -119,3 +122,39 @@
         return Collections.singletonMap("sessionId", sessionId);
     }
+
+    @RequestMapping(value = "/latest10opinions", method = RequestMethod.GET)
+    public List<Opinion> latest10opinions() {
+        return mainService.getLatest10Opinions();
+    }
+
+    @RequestMapping(value = "/latest10threads", method = RequestMethod.GET)
+    public List<_Thread> latest10threads() {
+        return mainService.getLatest10Threads();
+    }
+
+    @RequestMapping(value = "/subject/{id}/threads")
+    public List<_Thread> getThreadsBySubject(@PathVariable Long id) {
+        return mainService.getThreadsBySubject(id);
+    }
+
+    @RequestMapping(value = "/university/{id}/sectionAndPostCount")
+    public List<String> getUniversitySectionCount(@PathVariable Long id) {
+        return mainService.getUniversitySectionAndPostCount();
+    }
+
+    @RequestMapping(value = "/faculty/{id}/opinionCountForEachProfessor")
+    public List<String> getOpinionCountForEachProfessorInFaculty(@PathVariable Long id) {
+        return mainService.getOpinionCountForEachProfessorInFaculty(id);
+    }
+
+    @RequestMapping(value = "/study_programme/{id}/threadCountForEachSubject")
+    public List<String> getThreadCountForEachSubjectInStudyProgramme(@PathVariable Long id) {
+        return mainService.getThreadCountForEachSubjectInStudyProgramme(id);
+    }
+
+    @RequestMapping(value = "/user/{id}")
+    public CustomUserDetails getPublicUserProfile(@PathVariable Long id) {
+        return mainService.getPublicUserProfile(id);
+    }
+
 }
Index: springapp/src/main/java/mk/profesori/springapp/Controller/SecureController.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Controller/SecureController.java	(revision af801e3ae2a87e526d2053085fdbb077aafd6741)
+++ springapp/src/main/java/mk/profesori/springapp/Controller/SecureController.java	(revision 9bf1f8db5dd66185ddc4f7d093582ff73006f66b)
@@ -3,9 +3,10 @@
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import mk.profesori.springapp.Model.CustomUserDetails;
+import mk.profesori.springapp.Model.Post;
 import mk.profesori.springapp.Model.PostReport;
 import mk.profesori.springapp.Model.UserRole;
 import mk.profesori.springapp.Service.CustomUserDetailsService;
-import mk.profesori.springapp.Service.DisallowedOperationException;
-import mk.profesori.springapp.Service.IncompatiblePostId;
+import mk.profesori.springapp.Service.Exception.DisallowedOperationException;
+import mk.profesori.springapp.Service.Exception.IncompatiblePostId;
 import mk.profesori.springapp.Service.MainService;
 import org.apache.tomcat.websocket.AuthenticationException;
@@ -17,8 +18,9 @@
 
 import java.util.List;
+import java.util.Set;
 
 @RestController
 @RequestMapping("/secure")
-@CrossOrigin(origins = { "http://192.168.0.29:3000", "http://192.168.0.28:3000" })
+@CrossOrigin(origins = { "http://192.168.1.254:3000", "http://192.168.0.28:3000" })
 public class SecureController {
 
@@ -77,4 +79,13 @@
         if (authentication != null && authentication.getPrincipal() instanceof CustomUserDetails currentUser) {
             return customUserDetailsService.loadUserByUsername(currentUser.getEmail());
+        }
+        return null;
+    }
+
+    @RequestMapping(value = "/currentUser/posts", method = RequestMethod.GET)
+    public Set<Post> getPostsByUser(@CurrentSecurityContext SecurityContext context) {
+        Authentication authentication = context.getAuthentication();
+        if (authentication != null && authentication.getPrincipal() instanceof CustomUserDetails currentUser) {
+            return mainService.getPostsByUser(currentUser.getEmail());
         }
         return null;
Index: springapp/src/main/java/mk/profesori/springapp/Model/City.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Model/City.java	(revision af801e3ae2a87e526d2053085fdbb077aafd6741)
+++ springapp/src/main/java/mk/profesori/springapp/Model/City.java	(revision 9bf1f8db5dd66185ddc4f7d093582ff73006f66b)
@@ -1,21 +1,16 @@
 package mk.profesori.springapp.Model;
 
+import com.fasterxml.jackson.annotation.JsonIdentityInfo;
+import com.voodoodyne.jackson.jsog.JSOGGenerator;
+import lombok.Data;
+
+import javax.persistence.*;
 import java.util.HashSet;
 import java.util.Set;
 
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.OneToMany;
-import javax.persistence.Table;
-
-import com.fasterxml.jackson.annotation.JsonIdentityInfo;
-import com.fasterxml.jackson.annotation.ObjectIdGenerators;
-
 @Entity
+@Data
 @Table(name = "city")
-@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "cityId")
+@JsonIdentityInfo(generator = JSOGGenerator.class)
 public class City {
 
@@ -28,19 +23,7 @@
     private String cityName;
 
+    @Transient
     @OneToMany(mappedBy = "city")
     private Set<University> universities = new HashSet<>();
 
-    // getters
-    public Long getCityId() {
-        return cityId;
-    }
-
-    public String getCityName() {
-        return cityName;
-    }
-
-    public Set<University> getUniversities() {
-        return universities;
-    }
-
 }
Index: springapp/src/main/java/mk/profesori/springapp/Model/CustomUserDetails.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Model/CustomUserDetails.java	(revision af801e3ae2a87e526d2053085fdbb077aafd6741)
+++ springapp/src/main/java/mk/profesori/springapp/Model/CustomUserDetails.java	(revision 9bf1f8db5dd66185ddc4f7d093582ff73006f66b)
@@ -2,4 +2,5 @@
 
 import com.fasterxml.jackson.annotation.JsonIdentityInfo;
+import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.voodoodyne.jackson.jsog.JSOGGenerator;
 import lombok.EqualsAndHashCode;
@@ -31,19 +32,29 @@
     private String fullName;
     private String username;
+    @JsonIgnore
     private String email;
-    private String password; // TODO
+    @JsonIgnore
+    private String password;
+    /*  UseCases
+        го уредува својот кориснички профил
+        го верификува својот кориснички профил todo...
+    */
     @Enumerated(EnumType.STRING)
     private UserRole userRole;
     private Boolean locked = false;
     private Boolean enabled = false;
-    @OneToMany(mappedBy = "customUserDetails", fetch = FetchType.EAGER, orphanRemoval = true)
+    @Transient
+    @OneToMany(mappedBy = "customUserDetails", orphanRemoval = true)
     private Set<ConfirmationToken> confirmationTokens = new HashSet<>();
-    @OneToMany(mappedBy = "author", fetch = FetchType.EAGER, orphanRemoval = true)
+    @Transient
+    @OneToMany(mappedBy = "author", orphanRemoval = true)
     private Set<Post> authoredPosts = new HashSet<>();
     private Integer karma = 0;
 
+    @Transient
     @OneToMany(mappedBy = "user", cascade = CascadeType.ALL, orphanRemoval = true)
     private Set<PostVote> votes = new HashSet<>();
 
+    @Transient
     @OneToMany(mappedBy = "user", cascade = {CascadeType.PERSIST})
     private Set<PostReport> reportsSubmitted = new HashSet<>();
@@ -99,31 +110,7 @@
     }
 
-    public Set<Post> getAuthoredPosts() {
-        return this.authoredPosts;
-    }
-
-    public Integer getKarma() {
-        return this.karma;
-    }
-
-    public void setKarma(Integer karma) {
-        this.karma = karma;
-    }
-
     @Override
     public String toString() {
         return this.id.toString();
     }
-
-    public void setLocked(Boolean locked) {
-        this.locked = locked;
-    }
-
-    public Set<PostVote> getVotes() {
-        return votes;
-    }
-
-    public void setVotes(Set<PostVote> votes) {
-        this.votes = votes;
-    }
 }
Index: springapp/src/main/java/mk/profesori/springapp/Model/Faculty.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Model/Faculty.java	(revision af801e3ae2a87e526d2053085fdbb077aafd6741)
+++ springapp/src/main/java/mk/profesori/springapp/Model/Faculty.java	(revision 9bf1f8db5dd66185ddc4f7d093582ff73006f66b)
@@ -1,21 +1,14 @@
 package mk.profesori.springapp.Model;
 
+import com.fasterxml.jackson.annotation.JsonIdentityInfo;
+import com.voodoodyne.jackson.jsog.JSOGGenerator;
+import lombok.Data;
+
+import javax.persistence.*;
 import java.util.HashSet;
 import java.util.Set;
 
-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.OneToMany;
-import javax.persistence.Table;
-
-import com.fasterxml.jackson.annotation.JsonIdentityInfo;
-import com.voodoodyne.jackson.jsog.JSOGGenerator;
-
 @Entity
+@Data
 @Table(name = "faculty")
 @JsonIdentityInfo(generator = JSOGGenerator.class)
@@ -34,30 +27,11 @@
     private University university;
 
+    @Transient
     @OneToMany(mappedBy = "faculty")
     private Set<Professor> professors = new HashSet<>();
 
+    @Transient
     @OneToMany(mappedBy = "faculty")
     private Set<StudyProgramme> studyProgrammes = new HashSet<>();
 
-    // getters
-    public Long getFacultyId() {
-        return facultyId;
-    }
-
-    public String getFacultyName() {
-        return facultyName;
-    }
-
-    public University getUniversity() {
-        return university;
-    }
-
-    public Set<Professor> getProfessors() {
-        return professors;
-    }
-
-    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 af801e3ae2a87e526d2053085fdbb077aafd6741)
+++ springapp/src/main/java/mk/profesori/springapp/Model/Opinion.java	(revision 9bf1f8db5dd66185ddc4f7d093582ff73006f66b)
@@ -1,6 +1,6 @@
 package mk.profesori.springapp.Model;
 
-import java.time.LocalDateTime;
-import java.util.List;
+import lombok.Data;
+import lombok.NoArgsConstructor;
 
 import javax.persistence.DiscriminatorValue;
@@ -8,8 +8,9 @@
 import javax.persistence.JoinColumn;
 import javax.persistence.ManyToOne;
-
-import lombok.NoArgsConstructor;
+import java.time.LocalDateTime;
+import java.util.List;
 
 @Entity
+@Data
 @DiscriminatorValue("opinion")
 @NoArgsConstructor
@@ -35,12 +36,3 @@
         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 af801e3ae2a87e526d2053085fdbb077aafd6741)
+++ springapp/src/main/java/mk/profesori/springapp/Model/Post.java	(revision 9bf1f8db5dd66185ddc4f7d093582ff73006f66b)
@@ -3,4 +3,5 @@
 import com.fasterxml.jackson.annotation.JsonIdentityInfo;
 import com.voodoodyne.jackson.jsog.JSOGGenerator;
+import lombok.Data;
 import lombok.NoArgsConstructor;
 
@@ -13,4 +14,5 @@
 
 @Entity(name = "post")
+@Data
 @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
 @DiscriminatorColumn(name = "post_type", discriminatorType = DiscriminatorType.STRING)
@@ -44,9 +46,10 @@
     private Post parent;
 
-    @OneToMany(mappedBy = "post", cascade = CascadeType.ALL, orphanRemoval = true)
+    @OneToMany(mappedBy = "post", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
     private Set<PostVote> votes = new HashSet<>();
 
-    @OneToMany(mappedBy = "post", cascade={CascadeType.PERSIST})
+    @OneToMany(mappedBy = "post", cascade={CascadeType.PERSIST}, fetch = FetchType.EAGER)
     private Set<PostReport> reports = new HashSet<>();
+
     @PreRemove
     public void preRemove() {
@@ -56,80 +59,6 @@
         });
     }
-
-
-    @OneToMany(mappedBy = "parent", cascade = CascadeType.ALL, orphanRemoval = true)
+    @OneToMany(mappedBy = "parent", orphanRemoval = true, fetch = FetchType.EAGER)
     private List<Post> children = new ArrayList<>();
-
-    // getters and setters
-    public Set<PostVote> getVotes() {
-        return votes;
-    }
-
-    public void setVotes(Set<PostVote> votes) {
-        this.votes = votes;
-    }
-    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;
-    }
 
     // konstruktor so parent (koga e reply)
Index: springapp/src/main/java/mk/profesori/springapp/Model/PostReport.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Model/PostReport.java	(revision af801e3ae2a87e526d2053085fdbb077aafd6741)
+++ springapp/src/main/java/mk/profesori/springapp/Model/PostReport.java	(revision 9bf1f8db5dd66185ddc4f7d093582ff73006f66b)
@@ -1,4 +1,5 @@
 package mk.profesori.springapp.Model;
 
+import lombok.Data;
 import lombok.NoArgsConstructor;
 
@@ -7,4 +8,5 @@
 
 @Entity
+@Data
 @NoArgsConstructor
 public class PostReport {
@@ -38,51 +40,3 @@
         this.resolved=false;
     }
-
-    public boolean isResolved() {
-        return resolved;
-    }
-
-    public void setResolved(boolean resolved) {
-        this.resolved = resolved;
-    }
-
-    public Long getPostReportId() {
-        return postReportId;
-    }
-
-    public void setPostReportId(Long postReportId) {
-        this.postReportId = postReportId;
-    }
-
-    public CustomUserDetails getUser() {
-        return user;
-    }
-
-    public void setUser(CustomUserDetails user) {
-        this.user = user;
-    }
-
-    public Post getPost() {
-        return post;
-    }
-
-    public void setPost(Post post) {
-        this.post = post;
-    }
-
-    public LocalDateTime getTime() {
-        return time;
-    }
-
-    public void setTime(LocalDateTime time) {
-        this.time = time;
-    }
-
-    public String getDescription() {
-        return description;
-    }
-
-    public void setDescription(String description) {
-        this.description = description;
-    }
 }
Index: springapp/src/main/java/mk/profesori/springapp/Model/PostVote.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Model/PostVote.java	(revision af801e3ae2a87e526d2053085fdbb077aafd6741)
+++ springapp/src/main/java/mk/profesori/springapp/Model/PostVote.java	(revision 9bf1f8db5dd66185ddc4f7d093582ff73006f66b)
@@ -1,4 +1,5 @@
 package mk.profesori.springapp.Model;
 
+import lombok.Data;
 import lombok.NoArgsConstructor;
 
@@ -7,4 +8,5 @@
 
 @Entity
+@Data
 @NoArgsConstructor
 public class PostVote {
@@ -34,43 +36,3 @@
         this.vote = vote;
     }
-
-    public Long getPostVoteId() {
-        return postVoteId;
-    }
-
-    public void setPostVoteId(Long id) {
-        this.postVoteId = id;
-    }
-
-    public CustomUserDetails getUser() {
-        return user;
-    }
-
-    public void setUser(CustomUserDetails user) {
-        this.user = user;
-    }
-
-    public Post getPost() {
-        return post;
-    }
-
-    public void setPost(Post post) {
-        this.post = post;
-    }
-
-    public LocalDateTime getTime() {
-        return time;
-    }
-
-    public void setTime(LocalDateTime time) {
-        this.time = time;
-    }
-
-    public VoteType getVote() {
-        return vote;
-    }
-
-    public void setVote(VoteType vote) {
-        this.vote = vote;
-    }
 }
Index: springapp/src/main/java/mk/profesori/springapp/Model/Professor.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Model/Professor.java	(revision af801e3ae2a87e526d2053085fdbb077aafd6741)
+++ springapp/src/main/java/mk/profesori/springapp/Model/Professor.java	(revision 9bf1f8db5dd66185ddc4f7d093582ff73006f66b)
@@ -1,21 +1,14 @@
 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.ManyToOne;
-import javax.persistence.OneToMany;
-import javax.persistence.Table;
 
 import com.fasterxml.jackson.annotation.JsonIdentityInfo;
 import com.voodoodyne.jackson.jsog.JSOGGenerator;
+import lombok.Data;
+
+import javax.persistence.*;
+import java.util.ArrayList;
+import java.util.List;
 
 @Entity
+@Data
 @Table(name = "professor")
 @JsonIdentityInfo(generator = JSOGGenerator.class)
@@ -34,22 +27,6 @@
     private Faculty faculty;
 
+    @Transient
     @OneToMany(mappedBy = "targetProfessor", cascade = CascadeType.ALL)
-    private List<Opinion> relatedOpinions = new ArrayList<Opinion>();
-
-    // getters
-    public Long getProfessorId() {
-        return professorId;
-    }
-
-    public String getProfessorName() {
-        return professorName;
-    }
-
-    public Faculty getFaculty() {
-        return faculty;
-    }
-
-    public List<Opinion> getRelatedOpinions() {
-        return relatedOpinions;
-    }
+    private List<Opinion> relatedOpinions = new ArrayList<>();
 }
Index: springapp/src/main/java/mk/profesori/springapp/Model/StudyProgramme.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Model/StudyProgramme.java	(revision af801e3ae2a87e526d2053085fdbb077aafd6741)
+++ springapp/src/main/java/mk/profesori/springapp/Model/StudyProgramme.java	(revision 9bf1f8db5dd66185ddc4f7d093582ff73006f66b)
@@ -1,21 +1,14 @@
 package mk.profesori.springapp.Model;
 
+import com.fasterxml.jackson.annotation.JsonIdentityInfo;
+import com.voodoodyne.jackson.jsog.JSOGGenerator;
+import lombok.Data;
+
+import javax.persistence.*;
 import java.util.HashSet;
 import java.util.Set;
 
-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.OneToMany;
-import javax.persistence.Table;
-
-import com.fasterxml.jackson.annotation.JsonIdentityInfo;
-import com.voodoodyne.jackson.jsog.JSOGGenerator;
-
 @Entity
+@Data
 @Table(name = "study_programme")
 @JsonIdentityInfo(generator = JSOGGenerator.class)
@@ -37,27 +30,7 @@
     private Faculty faculty;
 
+    @Transient
     @OneToMany(mappedBy = "studyProgramme")
     private Set<Subject> subjects = new HashSet<>();
 
-    // getters
-    public Long getStudyProgrammeId() {
-        return studyProgrammeId;
-    }
-
-    public String getStudyProgrammeName() {
-        return studyProgrammeName;
-    }
-
-    public int getCycle() {
-        return cycle;
-    }
-
-    public Faculty getFaculty() {
-        return faculty;
-    }
-
-    public Set<Subject> getSubjects() {
-        return subjects;
-    }
-
 }
Index: springapp/src/main/java/mk/profesori/springapp/Model/Subject.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Model/Subject.java	(revision af801e3ae2a87e526d2053085fdbb077aafd6741)
+++ springapp/src/main/java/mk/profesori/springapp/Model/Subject.java	(revision 9bf1f8db5dd66185ddc4f7d093582ff73006f66b)
@@ -1,21 +1,14 @@
 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.ManyToOne;
-import javax.persistence.OneToMany;
-import javax.persistence.Table;
 
 import com.fasterxml.jackson.annotation.JsonIdentityInfo;
 import com.voodoodyne.jackson.jsog.JSOGGenerator;
+import lombok.Data;
+
+import javax.persistence.*;
+import java.util.ArrayList;
+import java.util.List;
 
 @Entity
+@Data
 @Table(name = "subject")
 @JsonIdentityInfo(generator = JSOGGenerator.class)
@@ -34,23 +27,7 @@
     private StudyProgramme studyProgramme;
 
+    @Transient
     @OneToMany(mappedBy = "targetSubject", cascade = CascadeType.ALL)
     private List<_Thread> threads = new ArrayList<>();
 
-    // getters
-    public Long getSubjectId() {
-        return subjectId;
-    }
-
-    public String getSubjectName() {
-        return subjectName;
-    }
-
-    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 af801e3ae2a87e526d2053085fdbb077aafd6741)
+++ springapp/src/main/java/mk/profesori/springapp/Model/University.java	(revision 9bf1f8db5dd66185ddc4f7d093582ff73006f66b)
@@ -1,21 +1,14 @@
 package mk.profesori.springapp.Model;
 
+import com.fasterxml.jackson.annotation.JsonIdentityInfo;
+import com.voodoodyne.jackson.jsog.JSOGGenerator;
+import lombok.Data;
+
+import javax.persistence.*;
 import java.util.HashSet;
 import java.util.Set;
 
-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.OneToMany;
-import javax.persistence.Table;
-
-import com.fasterxml.jackson.annotation.JsonIdentityInfo;
-import com.voodoodyne.jackson.jsog.JSOGGenerator;
-
 @Entity
+@Data
 @Table(name = "university")
 @JsonIdentityInfo(generator = JSOGGenerator.class)
@@ -34,23 +27,6 @@
     private City city;
 
+    @Transient
     @OneToMany(mappedBy = "university")
     private Set<Faculty> faculties = new HashSet<>();
-
-    // getters
-    public Long getUniversityId() {
-        return universityId;
-    }
-
-    public String getUniversityName() {
-        return universityName;
-    }
-
-    public City getCity() {
-        return city;
-    }
-
-    public Set<Faculty> getFaculties() {
-        return faculties;
-    }
-
 }
Index: springapp/src/main/java/mk/profesori/springapp/Model/_Thread.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Model/_Thread.java	(revision af801e3ae2a87e526d2053085fdbb077aafd6741)
+++ springapp/src/main/java/mk/profesori/springapp/Model/_Thread.java	(revision 9bf1f8db5dd66185ddc4f7d093582ff73006f66b)
@@ -1,17 +1,16 @@
 package mk.profesori.springapp.Model;
 
-import java.time.LocalDateTime;
-
-import java.util.List;
+import lombok.Data;
+import lombok.NoArgsConstructor;
 
 import javax.persistence.DiscriminatorValue;
-
 import javax.persistence.Entity;
 import javax.persistence.JoinColumn;
 import javax.persistence.ManyToOne;
-
-import lombok.NoArgsConstructor;
+import java.time.LocalDateTime;
+import java.util.List;
 
 @Entity
+@Data
 @DiscriminatorValue("thread")
 @NoArgsConstructor
@@ -36,11 +35,3 @@
         this.targetSubject = targetSubject;
     }
-
-    public Subject getTargetSubject() {
-        return targetSubject;
-    }
-
-    public void setTargetSubject(Subject targetSubject) {
-        this.targetSubject = targetSubject;
-    }
 }
Index: springapp/src/main/java/mk/profesori/springapp/Repository/CityRepository.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Repository/CityRepository.java	(revision af801e3ae2a87e526d2053085fdbb077aafd6741)
+++ springapp/src/main/java/mk/profesori/springapp/Repository/CityRepository.java	(revision 9bf1f8db5dd66185ddc4f7d093582ff73006f66b)
@@ -1,14 +1,12 @@
 package mk.profesori.springapp.Repository;
+
+import mk.profesori.springapp.Model.City;
+import org.springframework.data.repository.CrudRepository;
+import org.springframework.stereotype.Repository;
 
 import java.util.List;
 
-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>{
-
     List<City> findAll();
     City findByCityId(Long id);
Index: springapp/src/main/java/mk/profesori/springapp/Repository/FacultyRepository.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Repository/FacultyRepository.java	(revision af801e3ae2a87e526d2053085fdbb077aafd6741)
+++ springapp/src/main/java/mk/profesori/springapp/Repository/FacultyRepository.java	(revision 9bf1f8db5dd66185ddc4f7d093582ff73006f66b)
@@ -1,17 +1,23 @@
 package mk.profesori.springapp.Repository;
+
+import mk.profesori.springapp.Model.Faculty;
+import mk.profesori.springapp.Model.University;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.CrudRepository;
+import org.springframework.data.repository.query.Param;
+import org.springframework.stereotype.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.University;
-
 @Repository
 public interface FacultyRepository extends CrudRepository<Faculty, Long>{
-
     List<Faculty> findAll();
     Faculty findByFacultyId(Long id);
     List<Faculty> findByUniversity(University university);
+    @Query(value = "select professor.id, count(p.*)\n" +
+            "from professor left join post p on professor.id = p.professor_id\n" +
+            "where professor.faculty_id = :facultyId\n" +
+            "group by professor.id\n" +
+            "order by professor.id;", nativeQuery = true)
+    List<String> getOpinionCountForEachProfessorInFaculty(@Param("facultyId") Long id);
 }
Index: springapp/src/main/java/mk/profesori/springapp/Repository/OpinionRepository.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Repository/OpinionRepository.java	(revision af801e3ae2a87e526d2053085fdbb077aafd6741)
+++ springapp/src/main/java/mk/profesori/springapp/Repository/OpinionRepository.java	(revision 9bf1f8db5dd66185ddc4f7d093582ff73006f66b)
@@ -2,9 +2,14 @@
 
 import mk.profesori.springapp.Model.Opinion;
+import mk.profesori.springapp.Model.Professor;
 import org.springframework.data.repository.CrudRepository;
 import org.springframework.stereotype.Repository;
+
+import java.util.List;
 
 @Repository
 public interface OpinionRepository extends CrudRepository<Opinion,Long> {
     Opinion findByPostId(Long postId);
+    List<Opinion> findByTargetProfessor(Professor p);
+    List<Opinion> findTop10ByOrderByTimePosted();
 }
Index: springapp/src/main/java/mk/profesori/springapp/Repository/PostRepository.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Repository/PostRepository.java	(revision 9bf1f8db5dd66185ddc4f7d093582ff73006f66b)
+++ springapp/src/main/java/mk/profesori/springapp/Repository/PostRepository.java	(revision 9bf1f8db5dd66185ddc4f7d093582ff73006f66b)
@@ -0,0 +1,13 @@
+package mk.profesori.springapp.Repository;
+
+import mk.profesori.springapp.Model.CustomUserDetails;
+import mk.profesori.springapp.Model.Post;
+import org.springframework.data.repository.CrudRepository;
+import org.springframework.stereotype.Repository;
+
+import java.util.Set;
+
+@Repository
+public interface PostRepository extends CrudRepository<Post, Long> {
+    Set<Post> findByAuthor(CustomUserDetails c);
+}
Index: springapp/src/main/java/mk/profesori/springapp/Repository/PostVoteRepository.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Repository/PostVoteRepository.java	(revision af801e3ae2a87e526d2053085fdbb077aafd6741)
+++ springapp/src/main/java/mk/profesori/springapp/Repository/PostVoteRepository.java	(revision 9bf1f8db5dd66185ddc4f7d093582ff73006f66b)
@@ -1,10 +1,14 @@
 package mk.profesori.springapp.Repository;
 
+import mk.profesori.springapp.Model.Post;
 import mk.profesori.springapp.Model.PostVote;
 import org.springframework.data.repository.CrudRepository;
 import org.springframework.stereotype.Repository;
 
+import java.util.List;
+
 @Repository
 public interface PostVoteRepository extends CrudRepository<PostVote,Long> {
     PostVote findByPostVoteId(Long id);
+    List<PostVote> findByPost(Post post);
 }
Index: springapp/src/main/java/mk/profesori/springapp/Repository/ProfessorRepository.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Repository/ProfessorRepository.java	(revision af801e3ae2a87e526d2053085fdbb077aafd6741)
+++ springapp/src/main/java/mk/profesori/springapp/Repository/ProfessorRepository.java	(revision 9bf1f8db5dd66185ddc4f7d093582ff73006f66b)
@@ -1,12 +1,11 @@
 package mk.profesori.springapp.Repository;
 
-import java.util.List;
-
+import mk.profesori.springapp.Model.Faculty;
+import mk.profesori.springapp.Model.Professor;
 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;
+import java.util.List;
 
 @Repository
@@ -14,9 +13,6 @@
 
     List<Professor> findAll();
-
     Professor findByProfessorId(Long id);
-
     List<Professor> findByFaculty(Faculty faculty);
-
     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 af801e3ae2a87e526d2053085fdbb077aafd6741)
+++ springapp/src/main/java/mk/profesori/springapp/Repository/StudyProgrammeRepository.java	(revision 9bf1f8db5dd66185ddc4f7d093582ff73006f66b)
@@ -1,18 +1,24 @@
 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;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.CrudRepository;
+import org.springframework.data.repository.query.Param;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
 
 
 @Repository
 public interface StudyProgrammeRepository extends CrudRepository<StudyProgramme, Long>{
-    
     List<StudyProgramme> findAll();
     StudyProgramme findByStudyProgrammeId(Long id);
     List<StudyProgramme> findByFaculty(Faculty faculty);
+    @Query(value = "select subject.id, count(p.*)\n" +
+            "from subject left join post p on subject.id = p.subject_id\n" +
+            "where subject.study_programme_id = :studyProgrammeId\n" +
+            "group by subject.id\n" +
+            "order by subject.id;", nativeQuery = true)
+    List<String> getThreadCountForEachSubjectInStudyProgramme(@Param("studyProgrammeId") Long id);
 }
Index: springapp/src/main/java/mk/profesori/springapp/Repository/SubjectRepository.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Repository/SubjectRepository.java	(revision af801e3ae2a87e526d2053085fdbb077aafd6741)
+++ springapp/src/main/java/mk/profesori/springapp/Repository/SubjectRepository.java	(revision 9bf1f8db5dd66185ddc4f7d093582ff73006f66b)
@@ -1,11 +1,15 @@
 package mk.profesori.springapp.Repository;
 
+import mk.profesori.springapp.Model.StudyProgramme;
+import mk.profesori.springapp.Model.Subject;
 import org.springframework.data.repository.CrudRepository;
 import org.springframework.stereotype.Repository;
 
-import mk.profesori.springapp.Model.Subject;
+import java.util.List;
 
 @Repository
 public interface SubjectRepository extends CrudRepository<Subject, Long> {
     Subject findBySubjectId(Long id);
+    List<Subject> findByStudyProgramme(StudyProgramme studyProgramme);
+    List<Subject> findBySubjectNameContainingIgnoreCase(String name);
 }
Index: springapp/src/main/java/mk/profesori/springapp/Repository/UniversityRepository.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Repository/UniversityRepository.java	(revision af801e3ae2a87e526d2053085fdbb077aafd6741)
+++ springapp/src/main/java/mk/profesori/springapp/Repository/UniversityRepository.java	(revision 9bf1f8db5dd66185ddc4f7d093582ff73006f66b)
@@ -1,19 +1,39 @@
 package mk.profesori.springapp.Repository;
+
+import mk.profesori.springapp.Model.City;
+import mk.profesori.springapp.Model.University;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.CrudRepository;
+import org.springframework.stereotype.Repository;
 
 import java.util.List;
 
-import org.springframework.data.repository.CrudRepository;
-import org.springframework.stereotype.Repository;
-
-import mk.profesori.springapp.Model.City;
-import mk.profesori.springapp.Model.University;
-
 @Repository
 public interface UniversityRepository extends CrudRepository<University, Long> {
-
     List<University> findAll();
 
     University findByUniversityId(Long id);
-
     List<University> findByCity(City city);
+    
+    @Query(value = "select facultyid, sectioncount, opinioncount from\n" +
+            "(select faculty_id as facultyid, t1.subject_count+t2.professor_count as sectioncount\n" +
+            "from (select sp.faculty_id, count(*) as subject_count\n" +
+            "      from subject s join study_programme sp on s.study_programme_id = sp.id\n" +
+            "      group by sp.faculty_id) as t1\n" +
+            "         natural join\n" +
+            "     (select count(*) as professor_count, f.id as faculty_id\n" +
+            "      from professor p join faculty f on f.id = p.faculty_id\n" +
+            "      group by f.id) as t2) as q1\n" +
+            "natural join\n" +
+            "(select facultyid, count1+count2 as opinioncount from\n" +
+            "    (select pr.faculty_id as facultyid, count(*) as count1\n" +
+            "    from post po join professor pr on po.professor_id = pr.id\n" +
+            "    where professor_id is not null\n" +
+            "    group by pr.faculty_id) as t3\n" +
+            "    natural join\n" +
+            "    (select sp.faculty_id as facultyid, count(*) as count2\n" +
+            "    from post po join subject s on po.subject_id = s.id join study_programme sp on s.study_programme_id = sp.id\n" +
+            "    where po.subject_id is not null\n" +
+            "    group by sp.faculty_id) as t4) as q2;", nativeQuery = true)
+    List<String> findSectionAndPostCount();
 }
Index: springapp/src/main/java/mk/profesori/springapp/Repository/UserRepository.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Repository/UserRepository.java	(revision af801e3ae2a87e526d2053085fdbb077aafd6741)
+++ springapp/src/main/java/mk/profesori/springapp/Repository/UserRepository.java	(revision 9bf1f8db5dd66185ddc4f7d093582ff73006f66b)
@@ -1,6 +1,5 @@
 package mk.profesori.springapp.Repository;
 
-import java.util.Optional;
-
+import mk.profesori.springapp.Model.CustomUserDetails;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.Modifying;
@@ -9,5 +8,5 @@
 import org.springframework.transaction.annotation.Transactional;
 
-import mk.profesori.springapp.Model.CustomUserDetails;
+import java.util.Optional;
 
 @Repository
@@ -16,4 +15,5 @@
     Optional<CustomUserDetails> findByEmail(String email);
     Optional<CustomUserDetails> findByUsername(String username);
+    Optional<CustomUserDetails> findById(Long id);
 
     @Transactional
Index: springapp/src/main/java/mk/profesori/springapp/Repository/_ThreadRepository.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Repository/_ThreadRepository.java	(revision af801e3ae2a87e526d2053085fdbb077aafd6741)
+++ springapp/src/main/java/mk/profesori/springapp/Repository/_ThreadRepository.java	(revision 9bf1f8db5dd66185ddc4f7d093582ff73006f66b)
@@ -1,10 +1,15 @@
 package mk.profesori.springapp.Repository;
 
+import mk.profesori.springapp.Model.Subject;
 import mk.profesori.springapp.Model._Thread;
 import org.springframework.data.repository.CrudRepository;
 import org.springframework.stereotype.Repository;
 
+import java.util.List;
+
 @Repository
 public interface _ThreadRepository extends CrudRepository<_Thread,Long> {
     _Thread findByPostId(Long postId);
+    List<_Thread> findTop10ByOrderByTimePosted();
+    List<_Thread> findByTargetSubject(Subject s);
 }
Index: springapp/src/main/java/mk/profesori/springapp/Security/SecurityConfiguration.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Security/SecurityConfiguration.java	(revision af801e3ae2a87e526d2053085fdbb077aafd6741)
+++ springapp/src/main/java/mk/profesori/springapp/Security/SecurityConfiguration.java	(revision 9bf1f8db5dd66185ddc4f7d093582ff73006f66b)
@@ -37,5 +37,5 @@
             @Override
             public void addCorsMappings(CorsRegistry registry) {
-                registry.addMapping("/**").allowedOrigins("http://192.168.0.29:3000", "http://192.168.0.28:3000")
+                registry.addMapping("/**").allowedOrigins("http://192.168.1.254:3000", "http://192.168.0.28:3000")
                         .allowCredentials(true);
             }
Index: springapp/src/main/java/mk/profesori/springapp/Service/CustomUserDetailsService.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Service/CustomUserDetailsService.java	(revision af801e3ae2a87e526d2053085fdbb077aafd6741)
+++ springapp/src/main/java/mk/profesori/springapp/Service/CustomUserDetailsService.java	(revision 9bf1f8db5dd66185ddc4f7d093582ff73006f66b)
@@ -1,7 +1,8 @@
 package mk.profesori.springapp.Service;
 
-import java.time.LocalDateTime;
-import java.util.UUID;
-
+import lombok.AllArgsConstructor;
+import mk.profesori.springapp.Model.ConfirmationToken;
+import mk.profesori.springapp.Model.CustomUserDetails;
+import mk.profesori.springapp.Repository.UserRepository;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.core.userdetails.UserDetails;
@@ -12,8 +13,6 @@
 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;
+import java.time.LocalDateTime;
+import java.util.UUID;
 
 @Service
Index: springapp/src/main/java/mk/profesori/springapp/Service/DisallowedOperationException.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Service/DisallowedOperationException.java	(revision af801e3ae2a87e526d2053085fdbb077aafd6741)
+++ 	(revision )
@@ -1,7 +1,0 @@
-package mk.profesori.springapp.Service;
-
-public class DisallowedOperationException extends RuntimeException{
-    public DisallowedOperationException(String message) {
-        super(message);
-    }
-}
Index: springapp/src/main/java/mk/profesori/springapp/Service/Exception/DisallowedOperationException.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Service/Exception/DisallowedOperationException.java	(revision 9bf1f8db5dd66185ddc4f7d093582ff73006f66b)
+++ springapp/src/main/java/mk/profesori/springapp/Service/Exception/DisallowedOperationException.java	(revision 9bf1f8db5dd66185ddc4f7d093582ff73006f66b)
@@ -0,0 +1,7 @@
+package mk.profesori.springapp.Service.Exception;
+
+public class DisallowedOperationException extends RuntimeException{
+    public DisallowedOperationException(String message) {
+        super(message);
+    }
+}
Index: springapp/src/main/java/mk/profesori/springapp/Service/Exception/IncompatiblePostId.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Service/Exception/IncompatiblePostId.java	(revision 9bf1f8db5dd66185ddc4f7d093582ff73006f66b)
+++ springapp/src/main/java/mk/profesori/springapp/Service/Exception/IncompatiblePostId.java	(revision 9bf1f8db5dd66185ddc4f7d093582ff73006f66b)
@@ -0,0 +1,7 @@
+package mk.profesori.springapp.Service.Exception;
+
+public class IncompatiblePostId extends RuntimeException{
+    public IncompatiblePostId(String message) {
+        super(message);
+    }
+}
Index: springapp/src/main/java/mk/profesori/springapp/Service/IncompatiblePostId.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Service/IncompatiblePostId.java	(revision af801e3ae2a87e526d2053085fdbb077aafd6741)
+++ 	(revision )
@@ -1,7 +1,0 @@
-package mk.profesori.springapp.Service;
-
-public class IncompatiblePostId extends RuntimeException{
-    public IncompatiblePostId(String message) {
-        super(message);
-    }
-}
Index: springapp/src/main/java/mk/profesori/springapp/Service/MainService.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Service/MainService.java	(revision af801e3ae2a87e526d2053085fdbb077aafd6741)
+++ springapp/src/main/java/mk/profesori/springapp/Service/MainService.java	(revision 9bf1f8db5dd66185ddc4f7d093582ff73006f66b)
@@ -3,4 +3,6 @@
 import mk.profesori.springapp.Model.*;
 import mk.profesori.springapp.Repository.*;
+import mk.profesori.springapp.Service.Exception.DisallowedOperationException;
+import mk.profesori.springapp.Service.Exception.IncompatiblePostId;
 import org.springframework.security.core.userdetails.UsernameNotFoundException;
 import org.springframework.stereotype.Service;
@@ -9,4 +11,5 @@
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Set;
 
 @Service
@@ -24,6 +27,7 @@
     private final UserRepository userRepository;
     private final PostReportRepository postReportRepository;
-
-    public MainService(ProfessorRepository professorRepository, StudyProgrammeRepository studyProgrammeRepository, FacultyRepository facultyRepository, UniversityRepository universityRepository, CityRepository cityRepository, OpinionRepository opinionRepository, _ThreadRepository _threadRepository, SubjectRepository subjectRepository, PostVoteRepository postVoteRepository, UserRepository userRepository, PostReportRepository postReportRepository) {
+    private final PostRepository postRepository;
+
+    public MainService(ProfessorRepository professorRepository, StudyProgrammeRepository studyProgrammeRepository, FacultyRepository facultyRepository, UniversityRepository universityRepository, CityRepository cityRepository, OpinionRepository opinionRepository, _ThreadRepository _threadRepository, SubjectRepository subjectRepository, PostVoteRepository postVoteRepository, UserRepository userRepository, PostReportRepository postReportRepository, PostRepository postRepository) {
         this.professorRepository = professorRepository;
         this.studyProgrammeRepository = studyProgrammeRepository;
@@ -37,4 +41,5 @@
         this.userRepository = userRepository;
         this.postReportRepository = postReportRepository;
+        this.postRepository = postRepository;
     }
 
@@ -58,4 +63,8 @@
     public List<Professor> getProfessorsByNameContains(String contained) {
         return new ArrayList<>(professorRepository.findByProfessorNameContainingIgnoreCase(contained));
+    }
+
+    public List<Subject> getSubjectsByNameContains(String contained) {
+        return new ArrayList<>(subjectRepository.findBySubjectNameContainingIgnoreCase(contained));
     }
 
@@ -200,5 +209,5 @@
     public void delete_Thread(Long postId) {_threadRepository.deleteById(postId);}
 
-    public String updateOpinion(String newContent, Long newTargetProfessorId, Long newParentPostId, Long postId) {
+    public void updateOpinion(String newContent, Long newTargetProfessorId, Long newParentPostId, Long postId) {
         Opinion opinionToUpdate = opinionRepository.findByPostId(postId);
 
@@ -218,14 +227,22 @@
         opinionToUpdate.setParent(newParentOpinion);
 
+        propagateNewTargetProfessorToChildren(opinionToUpdate, newTargetProfessor);
+
+        opinionToUpdate.setTimeLastEdited(LocalDateTime.now());
+        opinionRepository.save(opinionToUpdate);
+    }
+
+    public void propagateNewTargetProfessorToChildren(Opinion opinionToUpdate, Professor newTargetProfessor) {
         for(Post p : opinionToUpdate.getChildren()) {
+            // direct children
             Opinion o = (Opinion) p;
             o.setTargetProfessor(newTargetProfessor);
+            // ancestors
+            if(o.getChildren().isEmpty()) return;
+            propagateNewTargetProfessorToChildren(o, newTargetProfessor);
         }
-        opinionToUpdate.setTimeLastEdited(LocalDateTime.now());
-        opinionRepository.save(opinionToUpdate);
-        return null;
-    }
-
-    public String update_Thread(String newTitle, String newContent, Long newTargetSubjectId, Long newParentThreadId, Long postId) {
+    }
+
+    public void update_Thread(String newTitle, String newContent, Long newTargetSubjectId, Long newParentThreadId, Long postId) {
         _Thread _threadToUpdate = _threadRepository.findByPostId(postId);
 
@@ -251,11 +268,19 @@
             }
 
-         for(Post p : _threadToUpdate.getChildren()) {
-                _Thread t = (_Thread) p;
-                t.setTargetSubject(newTargetSubject);
-            }
+         propagateNewTargetSubjectToChildren(_threadToUpdate, newTargetSubject);
+
          _threadToUpdate.setTimeLastEdited(LocalDateTime.now());
           _threadRepository.save(_threadToUpdate);
-          return null;
+    }
+
+    public void propagateNewTargetSubjectToChildren(_Thread _threadToUpdate, Subject newTargetSubject) {
+        for(Post p : _threadToUpdate.getChildren()) {
+            // direct children
+            _Thread t = (_Thread) p;
+            t.setTargetSubject(newTargetSubject);
+            // ancestors
+            if (t.getChildren().isEmpty()) return;
+            propagateNewTargetSubjectToChildren(t, newTargetSubject);
+        }
     }
 
@@ -306,3 +331,48 @@
         postReportRepository.save(reportToAdd);
     }
+
+    public List<Opinion> getRelatedOpinions(Long professorId) {
+        Professor p = professorRepository.findByProfessorId(professorId);
+        return opinionRepository.findByTargetProfessor(p);
+    }
+
+    public List<Opinion> getLatest10Opinions() {
+        return opinionRepository.findTop10ByOrderByTimePosted();
+    }
+    public List<_Thread> getLatest10Threads() {
+        return _threadRepository.findTop10ByOrderByTimePosted();
+    }
+
+    public List<String> getUniversitySectionAndPostCount() {
+        return universityRepository.findSectionAndPostCount();
+    }
+
+    public List<Subject> getSubjectsByStudyProgramme(Long studyProgrammeId) {
+        StudyProgramme sp = studyProgrammeRepository.findByStudyProgrammeId(studyProgrammeId);
+        return subjectRepository.findByStudyProgramme(sp);
+    }
+
+    public List<String> getOpinionCountForEachProfessorInFaculty(Long id) {
+        return facultyRepository.getOpinionCountForEachProfessorInFaculty(id);
+    }
+
+    public List<_Thread> getThreadsBySubject(Long id) {
+        Subject s = subjectRepository.findBySubjectId(id);
+        return _threadRepository.findByTargetSubject(s);
+    }
+
+    public List<String> getThreadCountForEachSubjectInStudyProgramme(Long id) {
+        return studyProgrammeRepository.getThreadCountForEachSubjectInStudyProgramme(id);
+    }
+
+    public Set<Post> getPostsByUser(String email) {
+        CustomUserDetails u = userRepository.findByEmail(email).orElseThrow(
+                () -> new UsernameNotFoundException(String.format("User with email %s not found", email)));
+        return postRepository.findByAuthor(u);
+    }
+
+    public CustomUserDetails getPublicUserProfile(Long id) {
+        return userRepository.findById(id).orElseThrow(
+                () -> new UsernameNotFoundException(String.format("User with id %d not found", id)));
+    }
 }
Index: springapp/src/main/java/mk/profesori/springapp/Service/RegistrationService.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Service/RegistrationService.java	(revision af801e3ae2a87e526d2053085fdbb077aafd6741)
+++ springapp/src/main/java/mk/profesori/springapp/Service/RegistrationService.java	(revision 9bf1f8db5dd66185ddc4f7d093582ff73006f66b)
@@ -45,5 +45,5 @@
                 String tokenToResend = customUserDetailsService
                         .createToken(userRepository.findByEmail(request.getEmail()).get());
-                String link = "http://192.168.0.29:8080/registration/confirm?token=" + tokenToResend;
+                String link = "http://192.168.1.254:8080/registration/confirm?token=" + tokenToResend;
                 emailSender.send(request.getEmail(), emailSender.buildEmail(request.getUsername(), link));
                 return tokenToResend;
@@ -66,5 +66,5 @@
                         UserRole.REGULAR));
 
-        String link = "http://192.168.0.29:8080/registration/confirm?token=" + token;
+        String link = "http://192.168.1.254:8080/registration/confirm?token=" + token;
 
         emailSender.send(request.getEmail(), emailSender.buildEmail(request.getUsername(), link));
