Index: actapp/src/Component/Professor.js
===================================================================
--- reactapp/src/Component/Professor.js	(revision 7cb8c3c8e176ea1118e2a936b1b3c7a82323b6a9)
+++ 	(revision )
@@ -1,36 +1,0 @@
-import React, { useEffect, useState } from "react";
-import { Link, Outlet, useParams } from "react-router-dom";
-
-function Professor() {
-  let params = useParams();
-
-  let [professor, setProfessor] = useState();
-
-  useEffect(() => {
-    const url = "http://192.168.0.17:8080/professor/1";
-
-    const fetchData = async () => {
-      try {
-        const response = await fetch(url);
-        const json = await response.json();
-        setProfessor(json);
-      } catch (error) {
-        console.log("error", error);
-      }
-    };
-
-    fetchData();
-  }, []);
-
-  return (
-    <div>
-      <div>
-        <div>{professor.professorName}</div>
-        <div>{professor.faculty.facultyName}</div>
-      </div>
-      <Outlet />
-    </div>
-  );
-}
-
-export default Professor;
Index: reactapp/src/Pages/Professor.js
===================================================================
--- reactapp/src/Pages/Professor.js	(revision 4a64cf077ae0fb1ad538efd00b1222fe7097c39d)
+++ reactapp/src/Pages/Professor.js	(revision 4a64cf077ae0fb1ad538efd00b1222fe7097c39d)
@@ -0,0 +1,45 @@
+import React, { useEffect, useState } from "react";
+import { Link, Outlet, useParams } from "react-router-dom";
+
+function Professor() {
+  let params = useParams();
+
+  let [professor, setProfessor] = useState(null);
+  let [loaded, setLoaded] = useState(null);
+
+  useEffect(() => {
+    const url = `http://192.168.0.17:8080/public/professor/${params.professorId}`;
+
+    const fetchData = async () => {
+      try {
+        const response = await fetch(url);
+        const json = await response.json();
+        setProfessor(json);
+        setLoaded(true);
+      } catch (error) {
+        console.log("error", error);
+      }
+    };
+
+    fetchData();
+  }, []);
+
+  if (loaded) {
+    return (
+      <div>
+        <div>{professor.professorName}</div>
+        <div>{professor.faculty.facultyName}</div>
+        <Outlet />
+      </div>
+    );
+  } else {
+    return (
+      <div>
+        <p>loading</p>
+        <Outlet />
+      </div>
+    );
+  }
+}
+
+export default Professor;
Index: reactapp/src/index.js
===================================================================
--- reactapp/src/index.js	(revision 7cb8c3c8e176ea1118e2a936b1b3c7a82323b6a9)
+++ reactapp/src/index.js	(revision 4a64cf077ae0fb1ad538efd00b1222fe7097c39d)
@@ -1,19 +1,13 @@
 import ReactDOM from "react-dom/client";
-import {
-  BrowserRouter,
-  Routes,
-  Route,
-} from "react-router-dom";
+import { BrowserRouter, Routes, Route } from "react-router-dom";
 import App from "./App";
-import Professor from "./Component/Professor";
+import Professor from "./Pages/Professor";
 
-const root = ReactDOM.createRoot(
-  document.getElementById("root")
-);
+const root = ReactDOM.createRoot(document.getElementById("root"));
 root.render(
   <BrowserRouter>
     <Routes>
       <Route path="/" element={<App />}>
-        <Route path="professor" element={<Professor />}>
+        <Route path="professor">
           <Route path=":professorId" element={<Professor />} />
         </Route>
Index: ringapp/src/main/java/mk/profesori/springapp/Controller/MainController.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Controller/MainController.java	(revision 7cb8c3c8e176ea1118e2a936b1b3c7a82323b6a9)
+++ 	(revision )
@@ -1,86 +1,0 @@
-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.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
-@CrossOrigin(origins = "http://192.168.0.17:3000")
-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);   //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
-    }
-
-}
Index: springapp/src/main/java/mk/profesori/springapp/Controller/PublicController.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Controller/PublicController.java	(revision 4a64cf077ae0fb1ad538efd00b1222fe7097c39d)
+++ springapp/src/main/java/mk/profesori/springapp/Controller/PublicController.java	(revision 4a64cf077ae0fb1ad538efd00b1222fe7097c39d)
@@ -0,0 +1,90 @@
+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.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 = "/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
+    }
+}
Index: springapp/src/main/java/mk/profesori/springapp/Controller/SecureController.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Controller/SecureController.java	(revision 4a64cf077ae0fb1ad538efd00b1222fe7097c39d)
+++ springapp/src/main/java/mk/profesori/springapp/Controller/SecureController.java	(revision 4a64cf077ae0fb1ad538efd00b1222fe7097c39d)
@@ -0,0 +1,54 @@
+package mk.profesori.springapp.Controller;
+
+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.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.RestController;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
+import mk.profesori.springapp.Model.CustomUserDetails;
+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;
+
+    @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);
+        }
+    }
+
+}
Index: springapp/src/main/java/mk/profesori/springapp/Model/Opinion.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Model/Opinion.java	(revision 7cb8c3c8e176ea1118e2a936b1b3c7a82323b6a9)
+++ springapp/src/main/java/mk/profesori/springapp/Model/Opinion.java	(revision 4a64cf077ae0fb1ad538efd00b1222fe7097c39d)
@@ -9,16 +9,28 @@
 import javax.persistence.ManyToOne;
 
+import lombok.NoArgsConstructor;
+
 @Entity
 @DiscriminatorValue("opinion")
+@NoArgsConstructor
 public class Opinion extends Post {
 
     @ManyToOne
-    @JoinColumn(name = "professor_id", nullable = false)
+    @JoinColumn(name = "professor_id")
     private Professor targetProfessor;
 
-    public Opinion(Long postId, String title, String content, CustomUserDetails author, LocalDateTime timePosted,
-            LocalDateTime timeLastEdited, Integer upvoteCount, Integer downvoteCount, Post parent,
-            List<Post> children, Professor targetProfessor) {
-        super(postId, title, content, author, timePosted, timeLastEdited, upvoteCount, downvoteCount, parent, children);
+    // konstruktor so parent (koga e reply)
+    public Opinion(String title, String content, CustomUserDetails author, LocalDateTime timePosted,
+            LocalDateTime timeLastEdited,
+            Integer upvoteCount, Integer downvoteCount, Post parent, List<Post> children, Professor targetProfessor) {
+        super(title, content, author, timePosted, timeLastEdited, upvoteCount, downvoteCount, parent, children);
+        this.targetProfessor = targetProfessor;
+    }
+
+    // konstruktor bez parent (koga NE e reply)
+    public Opinion(String title, String content, CustomUserDetails author, LocalDateTime timePosted,
+            LocalDateTime timeLastEdited,
+            Integer upvoteCount, Integer downvoteCount, List<Post> children, Professor targetProfessor) {
+        super(title, content, author, timePosted, timeLastEdited, upvoteCount, downvoteCount, children);
         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 7cb8c3c8e176ea1118e2a936b1b3c7a82323b6a9)
+++ springapp/src/main/java/mk/profesori/springapp/Model/Post.java	(revision 4a64cf077ae0fb1ad538efd00b1222fe7097c39d)
@@ -22,8 +22,11 @@
 import com.fasterxml.jackson.annotation.ObjectIdGenerators;
 
+import lombok.NoArgsConstructor;
+
 @Entity(name = "post")
 @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
 @DiscriminatorColumn(name = "post_type", discriminatorType = DiscriminatorType.STRING)
 @JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "postId")
+@NoArgsConstructor
 public class Post {
 
@@ -143,17 +146,32 @@
     }
 
-    public Post(Long postId, String title, String content, CustomUserDetails author, LocalDateTime timePosted,
-            LocalDateTime timeLastEdited, Integer upvoteCount, Integer downvoteCount, Post parent,
-            List<Post> children) {
-        this.postId = postId;
+    // konstruktor so parent (koga e reply)
+    public Post(String title, String content, CustomUserDetails author, LocalDateTime timePosted,
+            LocalDateTime timeLastEdited,
+            Integer upvoteCount, Integer downvoteCount, Post parent, List<Post> children) {
         this.title = title;
         this.content = content;
         this.author = author;
-        this.timePosted = timePosted;
-        this.timeLastEdited = timeLastEdited;
-        this.upvoteCount = upvoteCount;
-        this.downvoteCount = downvoteCount;
+        this.timePosted = LocalDateTime.now();
+        this.timeLastEdited = LocalDateTime.now();
+        this.upvoteCount = 0;
+        this.downvoteCount = 0;
         this.parent = parent;
-        this.children = children;
+        this.children = new ArrayList<>();
+    }
+
+    // konstruktor bez parent (koga NE e reply)
+    public Post(String title, String content, CustomUserDetails author, LocalDateTime timePosted,
+            LocalDateTime timeLastEdited,
+            Integer upvoteCount, Integer downvoteCount, List<Post> children) {
+        this.title = title;
+        this.content = content;
+        this.author = author;
+        this.timePosted = LocalDateTime.now();
+        this.timeLastEdited = LocalDateTime.now();
+        this.upvoteCount = 0;
+        this.downvoteCount = 0;
+        this.parent = null;
+        this.children = new ArrayList<>();
     }
 
Index: springapp/src/main/java/mk/profesori/springapp/Model/_Thread.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Model/_Thread.java	(revision 7cb8c3c8e176ea1118e2a936b1b3c7a82323b6a9)
+++ springapp/src/main/java/mk/profesori/springapp/Model/_Thread.java	(revision 4a64cf077ae0fb1ad538efd00b1222fe7097c39d)
@@ -1,5 +1,4 @@
 package mk.profesori.springapp.Model;
 
-import java.time.LocalDateTime;
 import java.util.ArrayList;
 import java.util.List;
@@ -28,12 +27,14 @@
     private Subject targetSubject;
 
-    public _Thread(Long postId, String title, String content, CustomUserDetails author, LocalDateTime timePosted,
-            LocalDateTime timeLastEdited, Integer upvoteCount, Integer downvoteCount, Post parent,
-            List<Post> children, List<String> tags, Section parentSection, Subject targetSubject) {
-        super(postId, title, content, author, timePosted, timeLastEdited, upvoteCount, downvoteCount, parent, children);
-        this.tags = tags;
-        this.parentSection = parentSection;
-        this.targetSubject = targetSubject;
-    }
+    // TODO
+    /*
+     * 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
Index: springapp/src/main/java/mk/profesori/springapp/Repository/OpinionRepository.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Repository/OpinionRepository.java	(revision 4a64cf077ae0fb1ad538efd00b1222fe7097c39d)
+++ springapp/src/main/java/mk/profesori/springapp/Repository/OpinionRepository.java	(revision 4a64cf077ae0fb1ad538efd00b1222fe7097c39d)
@@ -0,0 +1,11 @@
+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/Security/SecurityConfiguration.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Security/SecurityConfiguration.java	(revision 7cb8c3c8e176ea1118e2a936b1b3c7a82323b6a9)
+++ springapp/src/main/java/mk/profesori/springapp/Security/SecurityConfiguration.java	(revision 4a64cf077ae0fb1ad538efd00b1222fe7097c39d)
@@ -12,5 +12,4 @@
 
 import lombok.RequiredArgsConstructor;
-import mk.profesori.springapp.Service.CustomUserDetailsService;
 
 @Configuration
@@ -18,6 +17,4 @@
 @EnableWebSecurity
 public class SecurityConfiguration {
-
-    private final CustomUserDetailsService customUserDetailsService;
 
     @Bean
@@ -35,12 +32,14 @@
     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("/registration/**")
-                .permitAll()
-                .anyRequest()
-                .permitAll().and() // bese .authenticated()
+                .antMatchers("/secure/**").hasAnyAuthority("REGULAR", "MODERATOR")
+                .antMatchers("/public/**").permitAll()
+                .antMatchers("/registration/**").permitAll()
+                .and()
                 .formLogin();
 
Index: springapp/src/main/java/mk/profesori/springapp/Service/CustomUserDetailsService.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Service/CustomUserDetailsService.java	(revision 7cb8c3c8e176ea1118e2a936b1b3c7a82323b6a9)
+++ springapp/src/main/java/mk/profesori/springapp/Service/CustomUserDetailsService.java	(revision 4a64cf077ae0fb1ad538efd00b1222fe7097c39d)
@@ -64,4 +64,3 @@
         return userRepository.enableUser(email);
     }
-    
 }
Index: springapp/src/main/java/mk/profesori/springapp/Service/MainService.java
===================================================================
--- springapp/src/main/java/mk/profesori/springapp/Service/MainService.java	(revision 7cb8c3c8e176ea1118e2a936b1b3c7a82323b6a9)
+++ springapp/src/main/java/mk/profesori/springapp/Service/MainService.java	(revision 4a64cf077ae0fb1ad538efd00b1222fe7097c39d)
@@ -9,16 +9,19 @@
 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.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;
@@ -31,4 +34,6 @@
     @Autowired
     private CityRepository cityRepository;
+    @Autowired
+    private OpinionRepository opinionRepository;
 
     public List<Professor> getAllProfessors() {
@@ -45,5 +50,5 @@
 
     public List<Professor> getProfessorsByFacultyId(Long facultyId) {
-        
+
         Faculty faculty = facultyRepository.findByFacultyId(facultyId);
 
@@ -66,5 +71,5 @@
 
     public List<StudyProgramme> getStudyProgrammesByFacultyId(Long facultyId) {
-        
+
         Faculty faculty = facultyRepository.findByFacultyId(facultyId);
 
@@ -85,5 +90,5 @@
 
     public List<Faculty> getFacultiesByUniversityId(Long universityId) {
-        
+
         University university = universityRepository.findByUniversityId(universityId);
 
@@ -104,5 +109,5 @@
 
     public List<University> getUniversitiesByCityId(Long cityId) {
-        
+
         City city = cityRepository.findByCityId(cityId);
 
@@ -121,3 +126,26 @@
         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, 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,
+                null, null, targetOpinion, null, targetProfessor);
+        opinionRepository.save(opinionToAdd);
+
+        targetOpinion.getChildren().add(opinionToAdd);
+        opinionRepository.save(targetOpinion);
+    }
 }
