Index: Prototype Application/Paw5/src/main/java/finki/paw5/model/entities/Adoption.java
===================================================================
--- Prototype Application/Paw5/src/main/java/finki/paw5/model/entities/Adoption.java	(revision 4103eaa6cd6e6a73eec104a9fc23845ff4d110b9)
+++ Prototype Application/Paw5/src/main/java/finki/paw5/model/entities/Adoption.java	(revision 33b9f30f8d3cf434adca0001b56e8de3aba4f9ec)
@@ -5,5 +5,4 @@
 
 import java.time.LocalDate;
-import java.util.Date;
 
 @Data
@@ -27,7 +26,7 @@
 
     @Column(name = "id_adopter", nullable = false)
-    private int adopterId;
+    private Integer adopterId;
 
-    public Adoption(LocalDate startDate, LocalDate endDateFoster, boolean approved, int adopterId) {
+    public Adoption(LocalDate startDate, LocalDate endDateFoster, boolean approved, Integer adopterId) {
         this.startDate = startDate;
         this.endDateFoster = endDateFoster;
Index: Prototype Application/Paw5/src/main/java/finki/paw5/model/entities/PersonalProfile.java
===================================================================
--- Prototype Application/Paw5/src/main/java/finki/paw5/model/entities/PersonalProfile.java	(revision 4103eaa6cd6e6a73eec104a9fc23845ff4d110b9)
+++ Prototype Application/Paw5/src/main/java/finki/paw5/model/entities/PersonalProfile.java	(revision 33b9f30f8d3cf434adca0001b56e8de3aba4f9ec)
@@ -32,5 +32,5 @@
     private GroomingNeed groomingNeed;
 
-    public PersonalProfile(int id, FriendlyToKids friendlyToKids, FriendlyToPets friendlyToPets, AttentionNeed attentionNeed, PhysicalActivity physicalActivity, GroomingNeed groomingNeed) {
+    public PersonalProfile(Integer id, FriendlyToKids friendlyToKids, FriendlyToPets friendlyToPets, AttentionNeed attentionNeed, PhysicalActivity physicalActivity, GroomingNeed groomingNeed) {
         this.id = id;
         this.friendlyToKids = friendlyToKids;
Index: Prototype Application/Paw5/src/main/java/finki/paw5/model/exceptions/InvalidPetIdException.java
===================================================================
--- Prototype Application/Paw5/src/main/java/finki/paw5/model/exceptions/InvalidPetIdException.java	(revision 33b9f30f8d3cf434adca0001b56e8de3aba4f9ec)
+++ Prototype Application/Paw5/src/main/java/finki/paw5/model/exceptions/InvalidPetIdException.java	(revision 33b9f30f8d3cf434adca0001b56e8de3aba4f9ec)
@@ -0,0 +1,4 @@
+package finki.paw5.model.exceptions;
+
+public class InvalidPetIdException extends RuntimeException{
+}
Index: Prototype Application/Paw5/src/main/java/finki/paw5/service/AdoptionService.java
===================================================================
--- Prototype Application/Paw5/src/main/java/finki/paw5/service/AdoptionService.java	(revision 33b9f30f8d3cf434adca0001b56e8de3aba4f9ec)
+++ Prototype Application/Paw5/src/main/java/finki/paw5/service/AdoptionService.java	(revision 33b9f30f8d3cf434adca0001b56e8de3aba4f9ec)
@@ -0,0 +1,8 @@
+package finki.paw5.service;
+
+import finki.paw5.model.entities.Adoption;
+
+public interface AdoptionService {
+
+    void save(Adoption adoption);
+}
Index: Prototype Application/Paw5/src/main/java/finki/paw5/service/PersonalProfileService.java
===================================================================
--- Prototype Application/Paw5/src/main/java/finki/paw5/service/PersonalProfileService.java	(revision 33b9f30f8d3cf434adca0001b56e8de3aba4f9ec)
+++ Prototype Application/Paw5/src/main/java/finki/paw5/service/PersonalProfileService.java	(revision 33b9f30f8d3cf434adca0001b56e8de3aba4f9ec)
@@ -0,0 +1,10 @@
+package finki.paw5.service;
+
+import finki.paw5.model.entities.PersonalProfile;
+import finki.paw5.web.controllers.PostController;
+
+import java.util.Optional;
+
+public interface PersonalProfileService {
+    Optional<PersonalProfile> findById(Integer petId);
+}
Index: Prototype Application/Paw5/src/main/java/finki/paw5/service/PetService.java
===================================================================
--- Prototype Application/Paw5/src/main/java/finki/paw5/service/PetService.java	(revision 4103eaa6cd6e6a73eec104a9fc23845ff4d110b9)
+++ Prototype Application/Paw5/src/main/java/finki/paw5/service/PetService.java	(revision 33b9f30f8d3cf434adca0001b56e8de3aba4f9ec)
Index: Prototype Application/Paw5/src/main/java/finki/paw5/service/PostService.java
===================================================================
--- Prototype Application/Paw5/src/main/java/finki/paw5/service/PostService.java	(revision 4103eaa6cd6e6a73eec104a9fc23845ff4d110b9)
+++ Prototype Application/Paw5/src/main/java/finki/paw5/service/PostService.java	(revision 33b9f30f8d3cf434adca0001b56e8de3aba4f9ec)
@@ -2,4 +2,6 @@
 
 import finki.paw5.model.entities.Post;
+import java.util.List;
+import java.util.Optional;
 
 public interface PostService {
@@ -7,3 +9,6 @@
     void save (Post post);
 
+    List<Post> findAll();
+
+    Optional<Post> findById(Integer id);
 }
Index: Prototype Application/Paw5/src/main/java/finki/paw5/service/ShelterService.java
===================================================================
--- Prototype Application/Paw5/src/main/java/finki/paw5/service/ShelterService.java	(revision 4103eaa6cd6e6a73eec104a9fc23845ff4d110b9)
+++ Prototype Application/Paw5/src/main/java/finki/paw5/service/ShelterService.java	(revision 33b9f30f8d3cf434adca0001b56e8de3aba4f9ec)
@@ -4,6 +4,8 @@
 
 import java.util.List;
+import java.util.Optional;
 
 public interface ShelterService {
+    Optional<Shelter> findById(Integer id);
     List<Shelter> listShelters();
 }
Index: Prototype Application/Paw5/src/main/java/finki/paw5/service/implementation/AdoptionServiceImplementation.java
===================================================================
--- Prototype Application/Paw5/src/main/java/finki/paw5/service/implementation/AdoptionServiceImplementation.java	(revision 33b9f30f8d3cf434adca0001b56e8de3aba4f9ec)
+++ Prototype Application/Paw5/src/main/java/finki/paw5/service/implementation/AdoptionServiceImplementation.java	(revision 33b9f30f8d3cf434adca0001b56e8de3aba4f9ec)
@@ -0,0 +1,21 @@
+package finki.paw5.service.implementation;
+
+import finki.paw5.model.entities.Adoption;
+import finki.paw5.repository.AdoptionRepository;
+import finki.paw5.service.AdoptionService;
+import org.springframework.stereotype.Service;
+
+@Service
+public class AdoptionServiceImplementation implements AdoptionService {
+
+    private final AdoptionRepository adoptionRepository;
+
+    public AdoptionServiceImplementation(AdoptionRepository adoptionRepository) {
+        this.adoptionRepository = adoptionRepository;
+    }
+
+    @Override
+    public void save(Adoption adoption) {
+        this.adoptionRepository.save(adoption);
+    }
+}
Index: Prototype Application/Paw5/src/main/java/finki/paw5/service/implementation/PersonalProfileServiceImplementation.java
===================================================================
--- Prototype Application/Paw5/src/main/java/finki/paw5/service/implementation/PersonalProfileServiceImplementation.java	(revision 33b9f30f8d3cf434adca0001b56e8de3aba4f9ec)
+++ Prototype Application/Paw5/src/main/java/finki/paw5/service/implementation/PersonalProfileServiceImplementation.java	(revision 33b9f30f8d3cf434adca0001b56e8de3aba4f9ec)
@@ -0,0 +1,23 @@
+package finki.paw5.service.implementation;
+
+import finki.paw5.model.entities.PersonalProfile;
+import finki.paw5.repository.PersonalProfileRepository;
+import finki.paw5.service.PersonalProfileService;
+import org.springframework.stereotype.Service;
+
+import java.util.Optional;
+
+@Service
+public class PersonalProfileServiceImplementation implements PersonalProfileService {
+
+    private final PersonalProfileRepository personalProfileRepository;
+
+    public PersonalProfileServiceImplementation(PersonalProfileRepository personalProfileRepository) {
+        this.personalProfileRepository = personalProfileRepository;
+    }
+
+    @Override
+    public Optional<PersonalProfile> findById(Integer petId) {
+        return this.personalProfileRepository.findById(petId);
+    }
+}
Index: Prototype Application/Paw5/src/main/java/finki/paw5/service/implementation/PetServiceImplementation.java
===================================================================
--- Prototype Application/Paw5/src/main/java/finki/paw5/service/implementation/PetServiceImplementation.java	(revision 4103eaa6cd6e6a73eec104a9fc23845ff4d110b9)
+++ Prototype Application/Paw5/src/main/java/finki/paw5/service/implementation/PetServiceImplementation.java	(revision 33b9f30f8d3cf434adca0001b56e8de3aba4f9ec)
@@ -22,5 +22,4 @@
     }
 
-    @Override
     public List<Pet> listpets() {return this.petRepository.findAll();}
 
Index: Prototype Application/Paw5/src/main/java/finki/paw5/service/implementation/PostServiceImplementation.java
===================================================================
--- Prototype Application/Paw5/src/main/java/finki/paw5/service/implementation/PostServiceImplementation.java	(revision 4103eaa6cd6e6a73eec104a9fc23845ff4d110b9)
+++ Prototype Application/Paw5/src/main/java/finki/paw5/service/implementation/PostServiceImplementation.java	(revision 33b9f30f8d3cf434adca0001b56e8de3aba4f9ec)
@@ -5,4 +5,7 @@
 import finki.paw5.service.PostService;
 import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Optional;
 
 @Service
@@ -20,3 +23,12 @@
     }
 
+    @Override
+    public List<Post> findAll() {
+        return this.postRepository.findAll();
+    }
+
+    @Override
+    public Optional<Post> findById(Integer id) {
+        return this.postRepository.findById(id);
+    }
 }
Index: Prototype Application/Paw5/src/main/java/finki/paw5/service/implementation/ShelterServiceImplementation.java
===================================================================
--- Prototype Application/Paw5/src/main/java/finki/paw5/service/implementation/ShelterServiceImplementation.java	(revision 4103eaa6cd6e6a73eec104a9fc23845ff4d110b9)
+++ Prototype Application/Paw5/src/main/java/finki/paw5/service/implementation/ShelterServiceImplementation.java	(revision 33b9f30f8d3cf434adca0001b56e8de3aba4f9ec)
@@ -7,7 +7,9 @@
 
 import java.util.List;
+import java.util.Optional;
 
 @Service
 public class ShelterServiceImplementation implements ShelterService {
+
     private final ShelterRepository shelterRepository;
 
@@ -16,4 +18,8 @@
     }
 
+    @Override
+    public Optional<Shelter> findById(Integer id) {
+        return this.shelterRepository.findById(id);
+    }
 
     @Override
@@ -21,3 +27,5 @@
         return shelterRepository.findAll();
     }
+
+
 }
Index: Prototype Application/Paw5/src/main/java/finki/paw5/web/controllers/PetController.java
===================================================================
--- Prototype Application/Paw5/src/main/java/finki/paw5/web/controllers/PetController.java	(revision 4103eaa6cd6e6a73eec104a9fc23845ff4d110b9)
+++ Prototype Application/Paw5/src/main/java/finki/paw5/web/controllers/PetController.java	(revision 33b9f30f8d3cf434adca0001b56e8de3aba4f9ec)
@@ -1,6 +1,16 @@
 package finki.paw5.web.controllers;
 
+import finki.paw5.model.entities.Adoption;
+import finki.paw5.model.entities.Pet;
+import finki.paw5.model.entities.User;
+import finki.paw5.model.exceptions.InvalidPetIdException;
+import finki.paw5.service.AdoptionService;
 import finki.paw5.service.PetService;
+import jakarta.servlet.http.HttpServletRequest;
 import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+
+import java.time.LocalDate;
 
 @Controller
@@ -8,8 +18,25 @@
 
     private final PetService petService;
+    private final AdoptionService adoptionService;
 
-    public PetController(PetService petService) {
+    public PetController(PetService petService, AdoptionService adoptionService) {
         this.petService = petService;
+        this.adoptionService = adoptionService;
     }
 
+    @PostMapping("/submit-adopton-{id}")
+    public String saveAdoption(@PathVariable Integer id, HttpServletRequest request) {
+
+        Pet pet = this.petService.findById(id);
+        
+        User user = (User) request.getSession().getAttribute("user");
+
+        Adoption adoption = new Adoption(LocalDate.now(), null, false, user.getId());
+        this.adoptionService.save(adoption);
+
+        pet.setAdoptionId(adoption.getId());
+        this.petService.save(pet);
+
+        return "redirect:/home";
+    }
 }
Index: Prototype Application/Paw5/src/main/java/finki/paw5/web/controllers/PostController.java
===================================================================
--- Prototype Application/Paw5/src/main/java/finki/paw5/web/controllers/PostController.java	(revision 4103eaa6cd6e6a73eec104a9fc23845ff4d110b9)
+++ Prototype Application/Paw5/src/main/java/finki/paw5/web/controllers/PostController.java	(revision 33b9f30f8d3cf434adca0001b56e8de3aba4f9ec)
@@ -1,22 +1,24 @@
 package finki.paw5.web.controllers;
-
-import finki.paw5.model.entities.Employee;
 import finki.paw5.model.entities.Pet;
 import finki.paw5.model.entities.Post;
-import finki.paw5.model.entities.User;
+import finki.paw5.model.entities.Employee;
 import finki.paw5.model.enumerations.AgeGroup;
 import finki.paw5.model.enumerations.Gender;
 import finki.paw5.model.enumerations.Size;
 import finki.paw5.model.enumerations.Species;
+import finki.paw5.service.PersonalProfileService;
 import finki.paw5.service.PetService;
 import finki.paw5.service.PostService;
+import finki.paw5.service.ShelterService;
 import jakarta.servlet.http.HttpServletRequest;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 
 import java.time.LocalDate;
+import java.util.List;
 
 @Controller
@@ -25,8 +27,10 @@
     private final PostService postService;
     private final PetService petService;
+    private final PersonalProfileService personalProfileService;
 
-    public PostController(PostService postService, PetService petService) {
+    public PostController(PostService postService, PetService petService, PersonalProfileService personalProfileService, ShelterService shelterService) {
         this.postService = postService;
         this.petService = petService;
+        this.personalProfileService = personalProfileService;
     }
 
@@ -71,3 +75,36 @@
         return "redirect:/home";
     }
+
+    @GetMapping("/adoption-posts")
+    public String getAdoptionPosts(Model model, HttpServletRequest request){
+
+        List<Post> posts = this.postService.findAll();
+        List<Pet> pets = this.petService.listpets();
+        //model.addAttribute("posts", posts);
+        //model.addAttribute("pets",pets);
+        request.getSession().setAttribute("posts",posts);//temp
+        request.getSession().setAttribute("pets",pets);//temp
+
+        return "list-posts-adoption";
+    }
+
+    @GetMapping("/pet-details-{id}")
+    public String getPostDetails(@PathVariable Integer id, Model model, HttpServletRequest request){
+
+        Post post = this.postService.findById(id).get();
+        Pet pet = this.petService.findById(post.getPetId());
+
+        //model.addAttribute("pet", pet);
+        //model.addAttribute("post", post);
+        request.getSession().setAttribute("post", post);//temp
+        request.getSession().setAttribute("pet", pet);//temp
+
+        if(pet.getAdoptionId() != null){
+            request.getSession().setAttribute("disableAdoption", true);
+        } else{
+            request.getSession().setAttribute("disableAdoption", false);
+        }
+
+        return "pet-details";
+    }
 }
