Index: trip-planner/src/main/java/finki/diplomska/tripplanner/TripPlannerApplication.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/TripPlannerApplication.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ trip-planner/src/main/java/finki/diplomska/tripplanner/TripPlannerApplication.java	(revision 6a3a178323fd905112b5392bd9d3cb83b66ef2d3)
@@ -4,20 +4,8 @@
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.context.annotation.Bean;
-import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
-import org.springframework.web.cors.CorsConfiguration;
-import org.springframework.web.cors.CorsConfigurationSource;
-import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
-
-import java.util.Arrays;
 
 @SpringBootApplication
 @EnableEncryptableProperties
 public class TripPlannerApplication {
-
-    @Bean
-    BCryptPasswordEncoder bCryptPasswordEncoder(){
-        return new BCryptPasswordEncoder();
-    }
 
     public static void main(String[] args) {
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/models/Images.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/models/Images.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ 	(revision )
@@ -1,33 +1,0 @@
-package finki.diplomska.tripplanner.models;
-
-import com.fasterxml.jackson.annotation.JsonBackReference;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-import net.minidev.json.annotate.JsonIgnore;
-
-import javax.persistence.*;
-
-@Entity
-@Table(name = "images")
-@NoArgsConstructor
-@AllArgsConstructor
-@Getter
-@Setter
-public class Images {
-
-    @Id
-    @GeneratedValue(strategy = GenerationType.IDENTITY)
-    @Column(name = "id_image")
-    private Long id;
-
-    @Lob
-    @JsonIgnore
-    private byte[] content;
-
-    @ManyToOne
-    @JsonBackReference
-    @JoinColumn(name = "id_location", nullable = true)
-    private Location location;
-}
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/models/Location.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/models/Location.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ trip-planner/src/main/java/finki/diplomska/tripplanner/models/Location.java	(revision 6a3a178323fd905112b5392bd9d3cb83b66ef2d3)
@@ -2,5 +2,4 @@
 
 import com.fasterxml.jackson.annotation.JsonBackReference;
-import com.fasterxml.jackson.annotation.JsonManagedReference;
 import lombok.AllArgsConstructor;
 import lombok.Getter;
@@ -14,4 +13,5 @@
 @Entity
 @Table(name = "locations")
+@NoArgsConstructor
 @AllArgsConstructor
 @Getter
@@ -34,6 +34,4 @@
 
     private int duration;
-
-    private String trivia;
 
     @Lob
@@ -64,8 +62,4 @@
     private List<Planner> plannerList;
 
-    @ManyToOne
-    @JsonBackReference
-    @JoinColumn(name = "id_user")
-    private User user;
 
     @ManyToMany
@@ -77,22 +71,4 @@
     private List<Category> categoryList;
 
-    @OneToMany(mappedBy = "location", cascade = CascadeType.REMOVE, orphanRemoval = true)
-    @JsonManagedReference
-    private List<Images> imagesList;
 
-    public Location(String name, String description, String address, String priority, int duration, String trivia, byte[] photo, Region region, City city, User user) {
-        this.name = name;
-        this.description = description;
-        this.address = address;
-        this.priority = priority;
-        this.duration = duration;
-        this.trivia = trivia;
-        this.photo = photo;
-        this.region = region;
-        this.city = city;
-        this.user = user;
-    }
-
-    public Location() {
-    }
 }
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/models/Period.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/models/Period.java	(revision 6a3a178323fd905112b5392bd9d3cb83b66ef2d3)
+++ trip-planner/src/main/java/finki/diplomska/tripplanner/models/Period.java	(revision 6a3a178323fd905112b5392bd9d3cb83b66ef2d3)
@@ -0,0 +1,8 @@
+package finki.diplomska.tripplanner.models;
+
+import javax.persistence.Embeddable;
+
+@Embeddable
+public class Period {
+    private String period;
+}
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/models/Planner.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/models/Planner.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ trip-planner/src/main/java/finki/diplomska/tripplanner/models/Planner.java	(revision 6a3a178323fd905112b5392bd9d3cb83b66ef2d3)
@@ -1,5 +1,4 @@
 package finki.diplomska.tripplanner.models;
 
-import com.fasterxml.jackson.annotation.JsonIgnore;
 import lombok.*;
 
@@ -10,4 +9,5 @@
 @Data
 @Table(name = "planners")
+@NoArgsConstructor
 @AllArgsConstructor
 @Getter
@@ -26,5 +26,5 @@
     private String description;
 
-    @ManyToMany()
+    @ManyToMany
     @JoinTable(
             name = "planners_contain",
@@ -33,15 +33,9 @@
     private List<Location> locationList;
 
-    @ManyToOne(fetch = FetchType.EAGER)
-    private User user;
 
-    public Planner(){
-    }
-
-    public Planner(String name, String description, List<Location> locationList, User user){
+    public Planner(String name, String description, List<Location> locationList){
             this.name = name;
             this.description = description;
             this.locationList = locationList;
-            this.user = user;
     }
 
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/models/User.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/models/User.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ 	(revision )
@@ -1,100 +1,0 @@
-package finki.diplomska.tripplanner.models;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonManagedReference;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import lombok.Setter;
-import org.springframework.security.core.GrantedAuthority;
-import org.springframework.security.core.userdetails.UserDetails;
-
-import javax.persistence.*;
-import javax.validation.constraints.Email;
-import javax.validation.constraints.NotBlank;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.List;
-
-@Entity
-@Table(name = "users")
-@AllArgsConstructor
-@Getter
-@Setter
-public class User implements UserDetails {
-
-    @Id
-    @GeneratedValue(strategy = GenerationType.IDENTITY)
-    private Long id;
-
-    @Email(message = "Username needs to be an email")
-    @NotBlank(message = "username is required")
-    @Column(unique = true)
-    private String username;
-    @NotBlank(message = "Please enter your full name")
-    private String fullName;
-    @NotBlank(message = "Password field is required")
-    private String password;
-    @Transient
-    private String confirmPassword;
-    private Date create_At;
-    private Date update_At;
-
-    //OneToMany with Planners
-    @OneToMany(cascade = CascadeType.REFRESH, fetch = FetchType.EAGER, mappedBy = "user", orphanRemoval = true)
-    @JsonIgnore
-    private List<Planner> planners = new ArrayList<>();
-
-    @OneToMany(cascade = CascadeType.REFRESH, mappedBy = "user", orphanRemoval = true)
-    @JsonIgnore
-    private List<Location> locationList = new ArrayList<>();;
-
-    public User() {
-    }
-
-    public User(String username, String fullName, String password, String confirmPassword) {
-        this.username = username;
-        this.fullName = fullName;
-        this.password = password;
-        this.confirmPassword = confirmPassword;
-    }
-
-    @PrePersist
-    protected void onCreate(){
-        this.create_At = new Date();
-    }
-    @PreUpdate
-    protected void onUpdate(){
-        this.update_At = new Date();
-    }
-
-    @Override
-    @JsonIgnore
-    public Collection<? extends GrantedAuthority> getAuthorities() {
-        return null;
-    }
-
-    @Override
-    @JsonIgnore
-    public boolean isAccountNonExpired() {
-        return true;
-    }
-
-    @Override
-    @JsonIgnore
-    public boolean isAccountNonLocked() {
-        return true;
-    }
-
-    @Override
-    @JsonIgnore
-    public boolean isCredentialsNonExpired() {
-        return true;
-    }
-
-    @Override
-    @JsonIgnore
-    public boolean isEnabled() {
-        return true;
-    }
-}
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/models/dto/LocationDto.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/models/dto/LocationDto.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ 	(revision )
@@ -1,52 +1,0 @@
-package finki.diplomska.tripplanner.models.dto;
-
-import finki.diplomska.tripplanner.models.*;
-import lombok.Data;
-
-import java.util.List;
-
-@Data
-public class LocationDto {
-
-    private String name;
-
-    private String description;
-
-    private String address;
-
-    private String priority;
-
-    private int duration;
-
-    private String trivia;
-
-    private byte[] photo;
-
-    private Long region;
-
-    private Long city;
-
-    private String user;
-
-    private List<Long> companions;
-
-    private List<Long> categories;
-
-
-    public LocationDto(String name, String description, String address, String priority, int duration, String trivia, byte[] photo, Long region, Long city, String user ) {
-        this.name = name;
-        this.description = description;
-        this.address = address;
-        this.priority = priority;
-        this.duration = duration;
-        this.trivia = trivia;
-        this.photo = photo;
-        this.region = region;
-        this.city = city;
-        this.user = user;
-        this.companions = companions;
-        this.categories = categories;
-    }
-    public LocationDto() {
-    }
-}
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/models/dto/PlannerDto.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/models/dto/PlannerDto.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ trip-planner/src/main/java/finki/diplomska/tripplanner/models/dto/PlannerDto.java	(revision 6a3a178323fd905112b5392bd9d3cb83b66ef2d3)
@@ -1,6 +1,8 @@
 package finki.diplomska.tripplanner.models.dto;
 
+import finki.diplomska.tripplanner.models.Location;
 import lombok.Data;
 
+import java.util.List;
 
 @Data
@@ -9,10 +11,10 @@
     private String name;
     private String description;
-    private String user;
+    private List<Long> locationList;
 
-    public PlannerDto(String name, String description, String user) {
+    public PlannerDto(String name, String description, List<Long> locationList) {
         this.name = name;
         this.description = description;
-        this.user = user;
+        this.locationList = locationList;
     }
 }
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/models/dto/PlannerLocationDto.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/models/dto/PlannerLocationDto.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ 	(revision )
@@ -1,17 +1,0 @@
-package finki.diplomska.tripplanner.models.dto;
-
-import lombok.Data;
-
-@Data
-public class PlannerLocationDto {
-    private Long locationId;
-    private Long plannerId;
-
-    public PlannerLocationDto() {
-    }
-
-    public PlannerLocationDto(Long locationId, Long plannerId) {
-        this.locationId = locationId;
-        this.plannerId = plannerId;
-    }
-}
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/models/dto/UserDto.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/models/dto/UserDto.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ 	(revision )
@@ -1,29 +1,0 @@
-package finki.diplomska.tripplanner.models.dto;
-
-
-import lombok.Data;
-
-import java.util.Date;
-
-@Data
-public class UserDto {
-    private String username;
-
-    private String fullName;
-
-    private String password;
-
-    private String confirmPassword;
-
-    private Date create_At;
-
-    private Date update_At;
-
-    public UserDto(String username, String fullName, String password, String confirmPassword) {
-        this.username = username;
-        this.fullName = fullName;
-        this.password = password;
-        this.confirmPassword = confirmPassword;
-
-    }
-}
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/models/exceptions/CityNotFoundException.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/models/exceptions/CityNotFoundException.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ 	(revision )
@@ -1,10 +1,0 @@
-package finki.diplomska.tripplanner.models.exceptions;
-
-import org.springframework.http.HttpStatus;
-import org.springframework.web.bind.annotation.ResponseStatus;
-
-@ResponseStatus(HttpStatus.NOT_FOUND)
-public class CityNotFoundException extends RuntimeException{
-    public CityNotFoundException(Long id) {super(String.format("City with id %d is not found", id));}
-
-}
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/models/exceptions/CompanionNotFoundException.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/models/exceptions/CompanionNotFoundException.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ 	(revision )
@@ -1,10 +1,0 @@
-package finki.diplomska.tripplanner.models.exceptions;
-
-import org.springframework.http.HttpStatus;
-import org.springframework.web.bind.annotation.ResponseStatus;
-
-@ResponseStatus(HttpStatus.NOT_FOUND)
-public class CompanionNotFoundException extends RuntimeException{
-    public CompanionNotFoundException(Long id) {super(String.format("Companion with id %d is not found", id));}
-
-}
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/models/exceptions/CustomResponseEntityExceptionHandler.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/models/exceptions/CustomResponseEntityExceptionHandler.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ 	(revision )
@@ -1,18 +1,0 @@
-package finki.diplomska.tripplanner.models.exceptions;
-
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.ControllerAdvice;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.context.request.WebRequest;
-
-@ControllerAdvice
-@RestController
-public class CustomResponseEntityExceptionHandler {
-    @ExceptionHandler
-    public final ResponseEntity<Object> handleUsernameAlreadyExists(UsernameAlreadyExistsException ex, WebRequest request){
-        UsernameAlreadyExistsResponse exceptionResponse = new UsernameAlreadyExistsResponse(ex.getMessage());
-        return new ResponseEntity(exceptionResponse, HttpStatus.BAD_REQUEST);
-    }
-}
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/models/exceptions/InvalidLoginResponse.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/models/exceptions/InvalidLoginResponse.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ 	(revision )
@@ -1,27 +1,0 @@
-package finki.diplomska.tripplanner.models.exceptions;
-
-public class InvalidLoginResponse {
-    private String username;
-    private String password;
-
-    public InvalidLoginResponse() {
-        this.username = "Invalid username";
-        this.password = "Invalid password";
-    }
-
-    public String getUsername() {
-        return username;
-    }
-
-    public void setUsername(String username) {
-        this.username = username;
-    }
-
-    public String getPassword() {
-        return password;
-    }
-
-    public void setPassword(String password) {
-        this.password = password;
-    }
-}
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/models/exceptions/RegionNotFoundException.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/models/exceptions/RegionNotFoundException.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ 	(revision )
@@ -1,9 +1,0 @@
-package finki.diplomska.tripplanner.models.exceptions;
-
-import org.springframework.http.HttpStatus;
-import org.springframework.web.bind.annotation.ResponseStatus;
-
-@ResponseStatus(HttpStatus.NOT_FOUND)
-public class RegionNotFoundException extends RuntimeException{
-    public RegionNotFoundException(Long id){super(String.format("Region with id %d is not found", id));}
-}
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/models/exceptions/UsernameAlreadyExistsException.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/models/exceptions/UsernameAlreadyExistsException.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ 	(revision )
@@ -1,12 +1,0 @@
-package finki.diplomska.tripplanner.models.exceptions;
-
-import org.springframework.http.HttpStatus;
-import org.springframework.web.bind.annotation.ResponseStatus;
-
-@ResponseStatus(HttpStatus.BAD_REQUEST)
-public class UsernameAlreadyExistsException extends RuntimeException{
-
-    public UsernameAlreadyExistsException (String message){
-        super(message);
-    }
-}
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/models/exceptions/UsernameAlreadyExistsResponse.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/models/exceptions/UsernameAlreadyExistsResponse.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ 	(revision )
@@ -1,17 +1,0 @@
-package finki.diplomska.tripplanner.models.exceptions;
-
-public class UsernameAlreadyExistsResponse {
-    private String username;
-
-    public UsernameAlreadyExistsResponse(String username) {
-        this.username = username;
-    }
-
-    public String getUsername() {
-        return username;
-    }
-
-    public void setUsername(String username) {
-        this.username = username;
-    }
-}
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/payload/JWTLoginSucessReponse.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/payload/JWTLoginSucessReponse.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ 	(revision )
@@ -1,36 +1,0 @@
-package finki.diplomska.tripplanner.payload;
-
-public class JWTLoginSucessReponse {
-
-    private boolean success;
-    private String token;
-
-    public JWTLoginSucessReponse(boolean success, String token) {
-        this.success = success;
-        this.token = token;
-    }
-
-    public boolean isSuccess() {
-        return success;
-    }
-
-    public void setSuccess(boolean success) {
-        this.success = success;
-    }
-
-    public String getToken() {
-        return token;
-    }
-
-    public void setToken(String token) {
-        this.token = token;
-    }
-
-    @Override
-    public String toString() {
-        return "JWTLoginSucessReponse{" +
-                "success=" + success +
-                ", token='" + token + '\'' +
-                '}';
-    }
-}
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/payload/LoginRequest.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/payload/LoginRequest.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ 	(revision )
@@ -1,28 +1,0 @@
-package finki.diplomska.tripplanner.payload;
-
-import javax.validation.constraints.NotBlank;
-
-public class LoginRequest {
-
-    @NotBlank(message = "Username cannot be blank")
-    private String username;
-
-    @NotBlank(message = "Password cannot be blank")
-    private String password;
-
-    public String getUsername() {
-        return username;
-    }
-
-    public void setUsername(String username) {
-        this.username = username;
-    }
-
-    public String getPassword() {
-        return password;
-    }
-
-    public void setPassword(String password) {
-        this.password = password;
-    }
-}
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/repository/jpa/JpaImageRepository.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/repository/jpa/JpaImageRepository.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ 	(revision )
@@ -1,16 +1,0 @@
-package finki.diplomska.tripplanner.repository.jpa;
-
-import finki.diplomska.tripplanner.models.Images;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.data.repository.query.Param;
-import org.springframework.stereotype.Repository;
-
-import java.util.List;
-
-@Repository
-public interface JpaImageRepository extends JpaRepository<Images, Long> {
-
-    @Query(value = "SELECT * FROM images AS i WHERE i.id_location = :locationId", nativeQuery = true)
-    List<Images> getAllImagesForLocation(@Param("locationId") Long locationId);
-}
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/repository/jpa/JpaLocationRepository.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/repository/jpa/JpaLocationRepository.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ trip-planner/src/main/java/finki/diplomska/tripplanner/repository/jpa/JpaLocationRepository.java	(revision 6a3a178323fd905112b5392bd9d3cb83b66ef2d3)
@@ -44,75 +44,3 @@
             "GROUP BY l.id_location ORDER BY CASE l.priority WHEN 'high' THEN 1 WHEN 'medium' THEN 2 WHEN 'low' THEN 3 END", nativeQuery = true)
     List<Location> findLocationsFromCountry(@Param("locName") String ime, @Param("companion") String companion, @Param("region") String region, @Param("categories") List<String> categories);
-
-    @Query(value = "SELECT  * FROM locations AS l  " +
-            "LEFT JOIN recommended_companion AS rc " +
-            "ON l.id_location = rc.id_location " +
-            "LEFT JOIN companions AS companion " +
-            "ON rc.id_companion = companion.id_companion " +
-            "LEFT JOIN locations_belong lb " +
-            "ON l.id_location = lb.id_location " +
-            "LEFT JOIN categories AS category " +
-            "ON lb.id_category = category.id_category " +
-            "LEFT JOIN cities AS city " +
-            "ON city.id_city = l.id_city " +
-            "WHERE city.id_city = :cityId and companion.id_companion = :companionId and category.id_category IN (:categoryIds) " +
-            "GROUP BY l.id_location ORDER BY CASE l.priority WHEN 'high' THEN 1 WHEN 'medium' THEN 2 WHEN 'low' THEN 3 END", nativeQuery = true)
-    List<Location> findLocationsFromCityForm(@Param("cityId") Long cityId, @Param("companionId") Long companionId, @Param("categoryIds") List<Long> categoryIds);
-
-    @Query(value="SELECT * FROM locations AS location " +
-            "LEFT JOIN recommended_companion AS rc " +
-            "ON location.id_location = rc.id_location " +
-            "LEFT JOIN companions AS companion " +
-            "ON rc.id_companion = companion.id_companion " +
-            "LEFT JOIN locations_belong lb " +
-            "ON location.id_location = lb.id_location " +
-            "LEFT JOIN categories AS category " +
-            "ON lb.id_category = category.id_category " +
-            "LEFT JOIN regions AS region " +
-            "ON location.id_region = region.id_region " +
-            "LEFT JOIN cities AS city " +
-            "ON region.id_region  = city.id_region " +
-            "AND city.id_city = location.id_city " +
-            "WHERE region.id_region = :regionId AND companion.id_companion  = :companionId AND category.id_category  IN (:categoryIds) " +
-            "GROUP BY location.id_location ORDER BY CASE location.priority WHEN 'high' THEN 1 WHEN 'medium' THEN 2 WHEN 'low' THEN 3 END", nativeQuery = true)
-    List<Location> findLocationsFromRegionForm(@Param("regionId") Long regionId, @Param("companionId") Long companionId, @Param("categoryIds") List<Long> categoryIds);
-
-    @Query(value = "SELECT * " +
-            "FROM locations AS l " +
-            "WHERE l.id_location IN " +
-            "(SELECT pl.id_location FROM planners_contain AS pl WHERE pl.id_planner = :plannerId)", nativeQuery = true)
-    List<Location> getAllLocationsForPlanner(@Param("plannerId") Long plannerId);
-
-
-    @Query(value = "SELECT l.id_location " +
-            "FROM locations AS l " +
-            "WHERE l.id_location IN " +
-            "(SELECT pl.id_location FROM planners_contain AS pl WHERE pl.id_planner = :plannerId)", nativeQuery = true)
-    List<Long> getAllLocationIdsForPlanner(@Param("plannerId") Long plannerId);
-
-    @Query(value = "SELECT *, if(l.id_city is NOT NULL, c.city_name, l.location_name) as result " +
-            "FROM locations AS l " +
-            "LEFT JOIN cities AS c " +
-            "ON l.id_city = c.id_city " +
-            "LEFT JOIN locations_belong AS lb " +
-            "ON l.id_location = lb.id_location " +
-            "WHERE lb.id_category=20", nativeQuery = true)
-    List<Location> getWeekendGetaways();
-
-    @Query(value = "SELECT *, if(l.id_city is NOT NULL, c.city_name, l.location_name) as result " +
-            "FROM locations AS l " +
-            "LEFT JOIN cities AS c " +
-            "ON l.id_city = c.id_city " +
-            "LEFT JOIN locations_belong AS lb " +
-            "ON l.id_location = lb.id_location " +
-            "WHERE lb.id_category=4", nativeQuery = true)
-    List<Location> getVillages();
-
-    @Query(value = "SELECT * FROM locations AS l " +
-            "LEFT JOIN cities AS c " +
-            "ON l.id_city = c.id_city " +
-            "LEFT JOIN regions AS r " +
-            "ON l.id_region = r.id_region " +
-            "WHERE c.city_name = :place OR r.region_name = :place", nativeQuery = true)
-    List<Location> getAllLocations(@Param("place") String place);
 }
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/repository/jpa/JpaPlannerRepository.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/repository/jpa/JpaPlannerRepository.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ trip-planner/src/main/java/finki/diplomska/tripplanner/repository/jpa/JpaPlannerRepository.java	(revision 6a3a178323fd905112b5392bd9d3cb83b66ef2d3)
@@ -4,6 +4,4 @@
 import finki.diplomska.tripplanner.models.Planner;
 import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.data.repository.query.Param;
 import org.springframework.stereotype.Repository;
 
@@ -13,12 +11,4 @@
 public interface JpaPlannerRepository extends JpaRepository<Planner, Long> {
 
-        @Query(value = "SELECT * FROM planners AS p left JOIN users AS u ON p.user_id = u.id WHERE u.username like :username", nativeQuery = true)
-        List<Planner> getPlannersByUser(@Param("username") String username );
 
-        @Query(value = "DELETE planners_contain " +
-                "FROM planners_contain " +
-                "JOIN planners ON planners_contain.id_planner = planners.id_planner " +
-                "JOIN locations ON planners_contain.id_location = locations.id_location " +
-                "WHERE planners_contain.id_planner = :plannerId AND planners_contain.id_location = :locationId", nativeQuery = true)
-        void deleteLocationFromPlanner(@Param("plannerId") Long plannerId, @Param("locationId") Long locationId);
 }
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/repository/jpa/JpaRegionRepository.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/repository/jpa/JpaRegionRepository.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ trip-planner/src/main/java/finki/diplomska/tripplanner/repository/jpa/JpaRegionRepository.java	(revision 6a3a178323fd905112b5392bd9d3cb83b66ef2d3)
@@ -3,16 +3,7 @@
 import finki.diplomska.tripplanner.models.Region;
 import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.Query;
 import org.springframework.stereotype.Repository;
-
-import java.util.List;
 
 @Repository
 public interface JpaRegionRepository extends JpaRepository<Region, Long> {
-
-    @Query(value="SELECT r.region_name " +
-            "FROM regions AS r " +
-            "UNION all " +
-            "SELECT c.city_name FROM cities AS c", nativeQuery = true)
-    List<String> getAllCitiesAndRegions();
 }
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/repository/jpa/JpaUserRepository.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/repository/jpa/JpaUserRepository.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ 	(revision )
@@ -1,23 +1,0 @@
-package finki.diplomska.tripplanner.repository.jpa;
-
-import finki.diplomska.tripplanner.models.User;
-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 java.util.Optional;
-
-@Repository
-public interface JpaUserRepository extends CrudRepository<User, Long> {
-    User findByUsername(String username);
-    User getById(Long id);
-
-    @Query(value = "SELECT u.username FROM users AS u", nativeQuery = true)
-    List<String> getAllUsernames();
-
-    @Query(value = "SELECT u.password FROM users AS u WHERE u.username LIKE :username ", nativeQuery = true)
-    Optional<String> getPassword(@Param("username") String username);
-
-}
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/security/JwtAuthenticationEntryPoint.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/security/JwtAuthenticationEntryPoint.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ 	(revision )
@@ -1,28 +1,0 @@
-package finki.diplomska.tripplanner.security;
-
-import com.google.gson.Gson;
-import finki.diplomska.tripplanner.models.exceptions.InvalidLoginResponse;
-import org.springframework.security.core.AuthenticationException;
-import org.springframework.security.web.AuthenticationEntryPoint;
-import org.springframework.stereotype.Component;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-
-@Component
-public class JwtAuthenticationEntryPoint implements AuthenticationEntryPoint {
-    @Override
-    public void commence(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse,
-                         AuthenticationException e) throws IOException, ServletException {
-
-        InvalidLoginResponse loginResponse = new InvalidLoginResponse();
-        String jsonLoginResponse = new Gson().toJson(loginResponse);
-
-
-        httpServletResponse.setContentType("application/json");
-        httpServletResponse.setStatus(401);
-        httpServletResponse.getWriter().print(jsonLoginResponse);
-    }
-}
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/security/JwtAuthenticationFilter.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/security/JwtAuthenticationFilter.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ 	(revision )
@@ -1,66 +1,0 @@
-package finki.diplomska.tripplanner.security;
-
-import finki.diplomska.tripplanner.models.User;
-import finki.diplomska.tripplanner.service.impl.CustomUserDetailsServiceImpl;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
-import org.springframework.security.core.context.SecurityContextHolder;
-import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
-import org.springframework.util.StringUtils;
-import org.springframework.web.filter.OncePerRequestFilter;
-
-import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.util.Collections;
-
-public class JwtAuthenticationFilter extends OncePerRequestFilter {
-    @Autowired
-    private JwtTokenProvider tokenProvider;
-
-    @Autowired
-    private CustomUserDetailsServiceImpl customUserDetailsService;
-
-    @Override
-    protected void doFilterInternal(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse,
-                                    FilterChain filterChain) throws ServletException, IOException {
-
-        try {
-
-            String jwt = getJWTFromRequest(httpServletRequest);
-
-            if(StringUtils.hasText(jwt)&& tokenProvider.validateToken(jwt)){
-                Long userId = tokenProvider.getUserIdFromJWT(jwt);
-                User userDetails = customUserDetailsService.loadUserById(userId);
-
-                UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(
-                        userDetails, null, Collections.emptyList());
-
-                authentication.setDetails(new WebAuthenticationDetailsSource().buildDetails(httpServletRequest));
-                SecurityContextHolder.getContext().setAuthentication(authentication);
-
-            }
-
-        }catch (Exception ex){
-            logger.error("Could not set user authentication in security context", ex);
-        }
-
-
-        filterChain.doFilter(httpServletRequest, httpServletResponse);
-
-    }
-
-
-
-    private String getJWTFromRequest(HttpServletRequest request){
-        String bearerToken = request.getHeader(SecurityConstants.HEADER_STRING);
-
-        if(StringUtils.hasText(bearerToken)&&bearerToken.startsWith(SecurityConstants.TOKEN_PREFIX)){
-            return bearerToken.substring(7, bearerToken.length());
-        }
-
-        return null;
-    }
-}
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/security/JwtTokenProvider.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/security/JwtTokenProvider.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ 	(revision )
@@ -1,63 +1,0 @@
-package finki.diplomska.tripplanner.security;
-
-import finki.diplomska.tripplanner.models.User;
-import io.jsonwebtoken.*;
-import org.springframework.security.core.Authentication;
-import org.springframework.stereotype.Component;
-
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-
-@Component
-public class JwtTokenProvider {
-    //Generate the token
-
-    public String generateToken(Authentication authentication){
-        User user = (User)authentication.getPrincipal();
-        Date now = new Date(System.currentTimeMillis());
-
-        Date expiryDate = new Date(now.getTime()+SecurityConstants.EXPIRATION_TIME);
-
-        String userId = Long.toString(user.getId());
-
-        Map<String,Object> claims = new HashMap<>();
-        claims.put("id", (Long.toString(user.getId())));
-        claims.put("username", user.getUsername());
-        claims.put("fullName", user.getFullName());
-
-        return Jwts.builder()
-                .setSubject(userId)
-                .setClaims(claims)
-                .setIssuedAt(now)
-                .setExpiration(expiryDate)
-                .signWith(SignatureAlgorithm.HS512, SecurityConstants.SECRET)
-                .compact();
-    }
-
-    //Validate the token
-    public boolean validateToken(String token){
-        try{
-            Jwts.parser().setSigningKey(SecurityConstants.SECRET).parseClaimsJws(token);
-            return true;
-        }catch (SignatureException ex){
-            System.out.println("Invalid JWT Signature");
-        }catch (MalformedJwtException ex){
-            System.out.println("Invalid JWT Token");
-        }catch (ExpiredJwtException ex){
-            System.out.println("Expired JWT token");
-        }catch (UnsupportedJwtException ex){
-            System.out.println("Unsupported JWT token");
-        }catch (IllegalArgumentException ex){
-            System.out.println("JWT claims string is empty");
-        }
-        return false;
-    }
-    //Get user Id from token
-    public Long getUserIdFromJWT(String token){
-        Claims claims = Jwts.parser().setSigningKey(SecurityConstants.SECRET).parseClaimsJws(token).getBody();
-        String id = (String)claims.get("id");
-
-        return Long.parseLong(id);
-    }
-}
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/security/SecurityConfig.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/security/SecurityConfig.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ 	(revision )
@@ -1,87 +1,0 @@
-package finki.diplomska.tripplanner.security;
-
-
-import finki.diplomska.tripplanner.service.impl.CustomUserDetailsServiceImpl;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.security.authentication.AuthenticationManager;
-import org.springframework.security.config.BeanIds;
-import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
-import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
-import org.springframework.security.config.annotation.web.builders.HttpSecurity;
-import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
-import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
-import org.springframework.security.config.http.SessionCreationPolicy;
-import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
-import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
-
-import static finki.diplomska.tripplanner.security.SecurityConstants.MARIADB_URL;
-import static finki.diplomska.tripplanner.security.SecurityConstants.SIGN_UP_URLS;
-
-@Configuration
-@EnableWebSecurity
-@EnableGlobalMethodSecurity(
-        securedEnabled = true,
-        jsr250Enabled = true,
-        prePostEnabled = true
-)
-public class SecurityConfig extends WebSecurityConfigurerAdapter {
-
-    @Autowired
-    private JwtAuthenticationEntryPoint unauthorizedHandler;
-
-    @Autowired
-    private CustomUserDetailsServiceImpl customUserDetailsService;
-
-    @Bean
-    public JwtAuthenticationFilter jwtAuthenticationFilter() {return  new JwtAuthenticationFilter();}
-
-
-    @Autowired
-    private BCryptPasswordEncoder bCryptPasswordEncoder;
-
-    @Override
-    protected void configure(AuthenticationManagerBuilder authenticationManagerBuilder) throws Exception {
-        authenticationManagerBuilder.userDetailsService(customUserDetailsService).passwordEncoder(bCryptPasswordEncoder);
-    }
-
-    @Override
-    @Bean(BeanIds.AUTHENTICATION_MANAGER)
-    protected AuthenticationManager authenticationManager() throws Exception {
-        return super.authenticationManager();
-    }
-
-    @Override
-    protected void configure(HttpSecurity http) throws Exception {
-        http.cors().and().csrf().disable()
-                .exceptionHandling().authenticationEntryPoint(unauthorizedHandler).and()
-                .sessionManagement()
-                .sessionCreationPolicy(SessionCreationPolicy.STATELESS)
-                .and()
-                .headers().frameOptions().sameOrigin() //To enable H2 Database
-                .and()
-                .authorizeRequests()
-                .antMatchers(
-                        "/",
-                        "/favicon.ico",
-                        "/**/*.png",
-                        "/**/*.gif",
-                        "/**/*.svg",
-                        "/**/*.jpg",
-                        "/**/*.html",
-                        "/**/*.css",
-                        "/**/*.js"
-                ).permitAll()
-                .antMatchers(SIGN_UP_URLS).permitAll()
-                .antMatchers(MARIADB_URL).permitAll()
-                .antMatchers("/api/weekend").permitAll()
-                .antMatchers("/api/villages").permitAll()
-                .antMatchers("/api/cities").permitAll()
-                .antMatchers("/api/all").permitAll()
-                .antMatchers("/api/places").permitAll()
-                .anyRequest().authenticated();
-        http.addFilterBefore(jwtAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class);
-
-    }
-}
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/security/SecurityConstants.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/security/SecurityConstants.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ 	(revision )
@@ -1,10 +1,0 @@
-package finki.diplomska.tripplanner.security;
-
-public class SecurityConstants {
-    public static final String SIGN_UP_URLS = "/api/users/**";
-    public static final String MARIADB_URL = "jdbc:mariadb://127.0.0.1:3306/tripplanner";
-    public static final String SECRET ="SecretKeyToGenJWTs";
-    public static final String TOKEN_PREFIX= "Bearer ";
-    public static final String HEADER_STRING = "Authorization";
-    public static final long EXPIRATION_TIME = 3000_000; //30 min
-}
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/service/CategoryService.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/service/CategoryService.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ trip-planner/src/main/java/finki/diplomska/tripplanner/service/CategoryService.java	(revision 6a3a178323fd905112b5392bd9d3cb83b66ef2d3)
@@ -7,4 +7,3 @@
 public interface CategoryService {
     List<Category> findAll();
-
 }
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/service/ImagesService.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/service/ImagesService.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ 	(revision )
@@ -1,9 +1,0 @@
-package finki.diplomska.tripplanner.service;
-
-import finki.diplomska.tripplanner.models.Images;
-
-import java.util.List;
-
-public interface ImagesService {
-    List<Images> getAllImagesForLocation(Long locationId);
-}
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/service/LocationService.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/service/LocationService.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ trip-planner/src/main/java/finki/diplomska/tripplanner/service/LocationService.java	(revision 6a3a178323fd905112b5392bd9d3cb83b66ef2d3)
@@ -3,8 +3,4 @@
 
 import finki.diplomska.tripplanner.models.Location;
-import finki.diplomska.tripplanner.models.Planner;
-import finki.diplomska.tripplanner.models.dto.LocationDto;
-import finki.diplomska.tripplanner.models.dto.PlannerLocationDto;
-import org.springframework.data.repository.query.Param;
 
 import java.util.List;
@@ -14,17 +10,8 @@
 public interface LocationService {
     List<Location> findLocationsFromCity(String locName, String companion, List<String> categories);
-    List<Location> findLocationsFromCountry (String locName, String companion,String region, List<String> categories );
     List<Location> findAll();
     Location getById(Long id);
+    List<Location> findLocationsFromCountry (String locName, String companion,String region, List<String> categories );
     List<Location> scheduleLocations(String locName, String companion,String region, List<String> categories, int numberOfDays);
     Optional<Location> findById(Long id);
-    List<Location> findLocationsFromCityForm(Long cityId, Long companionId, Long lengthOfStay, String categoryIds);
-    List<Location> findLocationsFromRegionForm(Long regionId, Long companionId, Long lengthOfStay, String categoryIds);
-    Location addLocationToPlanner(PlannerLocationDto plannerLocationDto);
-    List<Location> getAllLocationsForPlanner(Long plannerId);
-    List<Location> getWeekendGetaways();
-    List<Location> getVillages();
-    List<Long> getAllLocationIdsForPlanner(Long plannerId);
-    List<Location> getAllLocations(String place);
-    Optional<Location> save (LocationDto locationDto, String username);
 }
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/service/PlannerService.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/service/PlannerService.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ trip-planner/src/main/java/finki/diplomska/tripplanner/service/PlannerService.java	(revision 6a3a178323fd905112b5392bd9d3cb83b66ef2d3)
@@ -4,6 +4,4 @@
 import finki.diplomska.tripplanner.models.Planner;
 import finki.diplomska.tripplanner.models.dto.PlannerDto;
-import finki.diplomska.tripplanner.models.dto.PlannerLocationDto;
-import org.springframework.http.ResponseEntity;
 
 import java.util.List;
@@ -13,11 +11,9 @@
 
         Planner createPlannerWithRequestParams(String description, String name, List<Location> locationList);
-        Optional<Planner> editPlanner(Long id, PlannerDto plannerDto, String username);
+        Optional<Planner> editPlanner(Long id, PlannerDto plannerDto);
         List<Planner> getAllPlaners();
-        List<Planner> getPlannersByUser(String username);
         Optional<Planner> findById(Long id);
+        Planner addLocationToPlanner(Long plannerId, Long locationId);
         Planner editPlannerWithRequestParams(Long id, String description, String name, List<Location> locationList);
-        Optional<Planner> newPlanner(PlannerDto plannerDto, String username);
-        void deletePlannerById(Long id);
-        ResponseEntity deleteLocationFromPlanner(PlannerLocationDto plannerLocationDto);
+        Optional<Planner> newPlanner(PlannerDto plannerDto);
 }
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/service/RegionService.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/service/RegionService.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ trip-planner/src/main/java/finki/diplomska/tripplanner/service/RegionService.java	(revision 6a3a178323fd905112b5392bd9d3cb83b66ef2d3)
@@ -7,4 +7,3 @@
 public interface RegionService {
     List<Region> findAll();
-    List<String> getAllCitiesAndRegions();
 }
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/service/UserService.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/service/UserService.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ 	(revision )
@@ -1,16 +1,0 @@
-package finki.diplomska.tripplanner.service;
-
-import finki.diplomska.tripplanner.models.User;
-import finki.diplomska.tripplanner.models.dto.UserDto;
-
-import java.util.List;
-import java.util.Optional;
-
-
-public interface UserService {
-
-    User saveUser (User user);
-    List<String> getAllUsernames();
-    Optional<String> getPassword(UserDto userDto);
-    Optional<User> findById(Long id);
-}
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/service/impl/CustomUserDetailsServiceImpl.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/service/impl/CustomUserDetailsServiceImpl.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ 	(revision )
@@ -1,34 +1,0 @@
-package finki.diplomska.tripplanner.service.impl;
-
-import finki.diplomska.tripplanner.models.User;
-import finki.diplomska.tripplanner.repository.jpa.JpaUserRepository;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.core.userdetails.UserDetails;
-import org.springframework.security.core.userdetails.UserDetailsService;
-import org.springframework.security.core.userdetails.UsernameNotFoundException;
-import org.springframework.stereotype.Service;
-
-import javax.transaction.Transactional;
-
-@Service
-public class CustomUserDetailsServiceImpl implements UserDetailsService {
-
-    @Autowired
-    private JpaUserRepository userRepository;
-
-    @Override
-    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
-        User user = userRepository.findByUsername(username);
-        if(user==null) new UsernameNotFoundException("User not found");
-        return user;
-    }
-
-
-    @Transactional
-    public User loadUserById(Long id){
-        User user = userRepository.getById(id);
-        if(user==null) new UsernameNotFoundException("User not found");
-        return user;
-
-    }
-}
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/service/impl/ImagesServiceImpl.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/service/impl/ImagesServiceImpl.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ 	(revision )
@@ -1,23 +1,0 @@
-package finki.diplomska.tripplanner.service.impl;
-
-import finki.diplomska.tripplanner.models.Images;
-import finki.diplomska.tripplanner.repository.jpa.JpaImageRepository;
-import finki.diplomska.tripplanner.service.ImagesService;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-@Service
-public class ImagesServiceImpl implements ImagesService {
-
-    private final JpaImageRepository jpaImageRepository;
-
-    public ImagesServiceImpl(JpaImageRepository jpaImageRepository) {
-        this.jpaImageRepository = jpaImageRepository;
-    }
-
-    @Override
-    public List<Images> getAllImagesForLocation(Long locationId) {
-        return this.jpaImageRepository.getAllImagesForLocation(locationId);
-    }
-}
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/service/impl/LocationServiceImpl.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/service/impl/LocationServiceImpl.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ trip-planner/src/main/java/finki/diplomska/tripplanner/service/impl/LocationServiceImpl.java	(revision 6a3a178323fd905112b5392bd9d3cb83b66ef2d3)
@@ -1,17 +1,11 @@
 package finki.diplomska.tripplanner.service.impl;
 
-import finki.diplomska.tripplanner.models.*;
-import finki.diplomska.tripplanner.models.dto.LocationDto;
-import finki.diplomska.tripplanner.models.dto.PlannerLocationDto;
-import finki.diplomska.tripplanner.models.exceptions.CityNotFoundException;
-import finki.diplomska.tripplanner.models.exceptions.CompanionNotFoundException;
+import finki.diplomska.tripplanner.models.Location;
 import finki.diplomska.tripplanner.models.exceptions.LocationNotFoundException;
-import finki.diplomska.tripplanner.models.exceptions.RegionNotFoundException;
-import finki.diplomska.tripplanner.repository.jpa.*;
+import finki.diplomska.tripplanner.repository.jpa.JpaLocationRepository;
 import finki.diplomska.tripplanner.service.LocationService;
 import org.springframework.stereotype.Service;
 
 import java.util.*;
-import java.util.stream.Collectors;
 
 
@@ -20,19 +14,7 @@
 
     private final JpaLocationRepository locationRepository;
-    private final JpaPlannerRepository plannerRepository;
-    private final JpaRegionRepository regionRepository;
-    private final JpaCityRepository cityRepository;
-    private final JpaUserRepository userRepository;
-    private final JpaCategoryRepository categoryRepository;
-    private final JpaCompanionRepository companionRepository;
 
-    public LocationServiceImpl(JpaLocationRepository locationRepository, JpaPlannerRepository plannerRepository, JpaRegionRepository regionRepository, JpaCityRepository cityRepository, JpaUserRepository userRepository, JpaCategoryRepository categoryRepository, JpaCompanionRepository companionRepository) {
+    public LocationServiceImpl(JpaLocationRepository locationRepository) {
         this.locationRepository = locationRepository;
-        this.plannerRepository = plannerRepository;
-        this.regionRepository = regionRepository;
-        this.cityRepository = cityRepository;
-        this.userRepository = userRepository;
-        this.categoryRepository = categoryRepository;
-        this.companionRepository = companionRepository;
     }
 
@@ -65,64 +47,4 @@
         return this.locationRepository.findById(id);
     }
-
-    @Override
-    public List<Location> findLocationsFromCityForm(Long cityId, Long companionId, Long lengthOfStay, String categoryIds) {
-        List<Long> categories = null;
-        if(categoryIds != null && !categoryIds.isEmpty()){
-            List<String> ids = Arrays.asList(categoryIds.split(","));
-            categories = ids.stream().map(Long::valueOf).collect(Collectors.toList());
-        }
-        Long maxMinutesPerDay = lengthOfStay *6 * 60;
-        int minutesPerDay = 0;
-        List<Location> citylocations = this.locationRepository.findLocationsFromCityForm(cityId, companionId, categories);
-        List<Location> newList = new ArrayList<>();
-        int listSize = citylocations.size();
-
-        while(minutesPerDay < maxMinutesPerDay ){
-            for(Location l: citylocations) {
-                if (minutesPerDay < maxMinutesPerDay && l.getDuration() + minutesPerDay <= maxMinutesPerDay && listSize != 0) {
-                    newList.add(l);
-                    listSize --;
-                }
-                minutesPerDay += l.getDuration();
-                if (minutesPerDay > maxMinutesPerDay) {
-                    break;
-                }
-            }
-        }
-
-        List<Location> foundLocations = locationRepository.findLocationsFromCityForm(cityId, companionId, categories);
-        return newList;
-    }
-
-    @Override
-    public List<Location> findLocationsFromRegionForm(Long regionId, Long companionId, Long lengthOfStay, String categoryIds) {
-        List<Long> categories = null;
-        if(categoryIds != null && !categoryIds.isEmpty()){
-            List<String> ids = Arrays.asList(categoryIds.split(","));
-            categories = ids.stream().map(Long::valueOf).collect(Collectors.toList());
-        }
-        Long maxMinutesPerDay = lengthOfStay *6 * 60;
-        int minutesPerDay = 0;
-        List<Location> countryLocations = this.locationRepository.findLocationsFromRegionForm(regionId, companionId, categories);
-        List<Location> newList = new ArrayList<>();
-        int listCountrySize = countryLocations.size();
-
-            while(minutesPerDay < maxMinutesPerDay){
-                for(Location l: countryLocations) {
-                    if (minutesPerDay < maxMinutesPerDay && l.getDuration() + minutesPerDay <= maxMinutesPerDay && listCountrySize != 0) {
-                        newList.add(l);
-                        listCountrySize --;
-                    }
-                    minutesPerDay += l.getDuration();
-                    if (minutesPerDay > maxMinutesPerDay) {
-                        break;
-                    }
-                }
-
-        }
-        return newList;
-    }
-
 
     @Override
@@ -163,57 +85,7 @@
             }
         }
+
         return newList;
     }
 
-    @Override
-    public Location addLocationToPlanner(PlannerLocationDto plannerLocationDto) {
-        Location location = this.locationRepository.findById(plannerLocationDto.getLocationId())
-                .orElseThrow(() -> new LocationNotFoundException(plannerLocationDto.getLocationId()));
-        Planner planner = this.plannerRepository.getById(plannerLocationDto.getPlannerId());
-        planner.getLocationList().add(location);
-        return this.locationRepository.save(location);
-    }
-
-    @Override
-    public List<Location> getAllLocationsForPlanner(Long plannerId) {
-        return this.locationRepository.getAllLocationsForPlanner(plannerId);
-    }
-
-    @Override
-    public List<Location> getWeekendGetaways() {
-        return this.locationRepository.getWeekendGetaways();
-    }
-
-    @Override
-    public List<Location> getVillages() {
-        return this.locationRepository.getVillages();
-    }
-
-    @Override
-    public List<Long> getAllLocationIdsForPlanner(Long plannerId) {
-        return this.locationRepository.getAllLocationIdsForPlanner(plannerId);
-    }
-
-    @Override
-    public List<Location> getAllLocations(String place) {
-        return this.locationRepository.getAllLocations(place);
-    }
-
-    @Override
-    public Optional<Location> save(LocationDto locationDto, String username) {
-        City city = new City();
-        Region region = this.regionRepository.findById(locationDto.getRegion())
-                .orElseThrow(() -> new RegionNotFoundException(locationDto.getRegion()));
-        if(locationDto.getCity() != null){
-             city = this.cityRepository.findById(locationDto.getCity())
-                    .orElseThrow(() -> new CityNotFoundException(locationDto.getCity()));
-        }else{
-            city = null;
-        }
-        User user = this.userRepository.findByUsername(username);
-        locationDto.setUser(user.getUsername());
-        return Optional.of(this.locationRepository.save(new Location(locationDto.getName(), locationDto.getDescription(), locationDto.getAddress(), locationDto.getPriority(),
-                locationDto.getDuration(), locationDto.getTrivia(), locationDto.getPhoto(), region, city, user)));
-    }
-
 }
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/service/impl/MapValidationErrorService.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/service/impl/MapValidationErrorService.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ 	(revision )
@@ -1,28 +1,0 @@
-package finki.diplomska.tripplanner.service.impl;
-
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.stereotype.Service;
-import org.springframework.validation.BindingResult;
-import org.springframework.validation.FieldError;
-
-import java.util.HashMap;
-import java.util.Map;
-
-@Service
-public class MapValidationErrorService {
-    public ResponseEntity<?> MapValidationService(BindingResult result){
-
-        if(result.hasErrors()){
-            Map<String, String> errorMap = new HashMap<>();
-
-            for(FieldError error: result.getFieldErrors()){
-                errorMap.put(error.getField(), error.getDefaultMessage());
-            }
-            return new ResponseEntity<Map<String, String>>(errorMap, HttpStatus.BAD_REQUEST);
-        }
-
-        return null;
-
-    }
-}
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/service/impl/PlannerServiceImpl.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/service/impl/PlannerServiceImpl.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ trip-planner/src/main/java/finki/diplomska/tripplanner/service/impl/PlannerServiceImpl.java	(revision 6a3a178323fd905112b5392bd9d3cb83b66ef2d3)
@@ -3,16 +3,15 @@
 import finki.diplomska.tripplanner.models.Location;
 import finki.diplomska.tripplanner.models.Planner;
-import finki.diplomska.tripplanner.models.User;
 import finki.diplomska.tripplanner.models.dto.PlannerDto;
-import finki.diplomska.tripplanner.models.dto.PlannerLocationDto;
 import finki.diplomska.tripplanner.models.exceptions.LocationNotFoundException;
 import finki.diplomska.tripplanner.models.exceptions.PlannerNotFoundException;
 import finki.diplomska.tripplanner.repository.jpa.JpaLocationRepository;
 import finki.diplomska.tripplanner.repository.jpa.JpaPlannerRepository;
-import finki.diplomska.tripplanner.repository.jpa.JpaUserRepository;
+import finki.diplomska.tripplanner.service.LocationService;
 import finki.diplomska.tripplanner.service.PlannerService;
-import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Service;
+import reactor.util.annotation.Nullable;
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Optional;
@@ -23,10 +22,10 @@
     private final JpaPlannerRepository plannerRepository;
     private final JpaLocationRepository locationRepository;
-    private final JpaUserRepository userRepository;
+    private final LocationService locationService;
 
-    public PlannerServiceImpl(JpaPlannerRepository plannerRepository, JpaLocationRepository locationRepository, JpaUserRepository userRepository) {
+    public PlannerServiceImpl(JpaPlannerRepository plannerRepository, JpaLocationRepository locationRepository, LocationService locationService) {
         this.plannerRepository = plannerRepository;
         this.locationRepository = locationRepository;
-        this.userRepository = userRepository;
+        this.locationService = locationService;
     }
 
@@ -37,18 +36,19 @@
 
     @Override
-    public List<Planner> getPlannersByUser(String username) {
-        User user = this.userRepository.findByUsername(username);
-        return this.plannerRepository.getPlannersByUser(user.getUsername());
-    }
-
-    @Override
     public Optional<Planner> findById(Long id) {
         return this.plannerRepository.findById(id);
     }
 
+    @Override
+    public Planner addLocationToPlanner(Long plannerId, Long locationId) {
+        Location location = this.locationService.findById(locationId)
+                .orElseThrow(() -> new LocationNotFoundException(locationId));
+        Planner planner = this.plannerRepository.getById(plannerId);
+        planner.getLocationList().add(location);
+        return this.plannerRepository.save(planner);
+    }
 
     @Override
-    public Optional<Planner> newPlanner(PlannerDto plannerDto, String username) {
-        /*
+    public Optional<Planner> newPlanner(PlannerDto plannerDto) {
         List<Location> locationList  = new ArrayList<>();
         for(Long location : plannerDto.getLocationList()){
@@ -57,19 +57,5 @@
             locationList.add(loc);
         }
-         */
-        User user = this.userRepository.findByUsername(username);
-        plannerDto.setUser(user.getUsername());
-        return Optional.of(this.plannerRepository.save(new Planner(plannerDto.getName(), plannerDto.getDescription(), null, user)));
-    }
-
-    @Override
-    public void deletePlannerById(Long id) {
-        this.plannerRepository.deleteById(id);
-    }
-
-    @Override
-    public ResponseEntity deleteLocationFromPlanner(PlannerLocationDto plannerLocationDto) {
-        plannerRepository.deleteLocationFromPlanner(plannerLocationDto.getPlannerId(), plannerLocationDto.getLocationId());
-        return null;
+        return Optional.of(this.plannerRepository.save(new Planner(plannerDto.getName(), plannerDto.getDescription(),  locationList)));
     }
 
@@ -90,13 +76,10 @@
 
     @Override
-    public Optional<Planner> editPlanner(Long id, PlannerDto plannerDto, String username) {
+    public Optional<Planner> editPlanner(Long id, PlannerDto plannerDto) {
         Planner planner = this.plannerRepository.findById(id).orElseThrow(() -> new PlannerNotFoundException(id));
-        User user = this.userRepository.findByUsername(username);
 
         planner.setName(plannerDto.getName());
         planner.setDescription(plannerDto.getDescription());
-        plannerDto.setUser(user.getUsername());
-        planner.setUser(user);
-/*
+
         List<Location> locationList  = new ArrayList<>();
         for(Long location : plannerDto.getLocationList()){
@@ -106,6 +89,4 @@
         }
         planner.setLocationList(locationList);
-
- */
         return Optional.of(this.plannerRepository.save(planner));
     }
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/service/impl/RegionServiceImpl.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/service/impl/RegionServiceImpl.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ trip-planner/src/main/java/finki/diplomska/tripplanner/service/impl/RegionServiceImpl.java	(revision 6a3a178323fd905112b5392bd9d3cb83b66ef2d3)
@@ -21,8 +21,3 @@
         return this.regionRepository.findAll();
     }
-
-    @Override
-    public List<String> getAllCitiesAndRegions() {
-        return this.regionRepository.getAllCitiesAndRegions();
-    }
 }
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/service/impl/UserServiceImpl.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/service/impl/UserServiceImpl.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ 	(revision )
@@ -1,56 +1,0 @@
-package finki.diplomska.tripplanner.service.impl;
-
-import finki.diplomska.tripplanner.models.User;
-import finki.diplomska.tripplanner.models.dto.UserDto;
-import finki.diplomska.tripplanner.models.exceptions.UsernameAlreadyExistsException;
-import finki.diplomska.tripplanner.repository.jpa.JpaUserRepository;
-import finki.diplomska.tripplanner.service.UserService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.ResponseEntity;
-import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-import java.util.Optional;
-
-
-@Service
-public class UserServiceImpl  implements UserService {
-
-    @Autowired
-    private JpaUserRepository userRepository;
-
-    @Autowired
-    private BCryptPasswordEncoder bCryptPasswordEncoder;
-
-    public User saveUser (User newUser){
-        try{
-            newUser.setPassword(bCryptPasswordEncoder.encode(newUser.getPassword()));
-            //Username has to be unique (exception)
-            newUser.setUsername(newUser.getUsername());
-            // Make sure that password and confirmPassword match
-            // We don't persist or show the confirmPassword
-            newUser.setConfirmPassword("");
-             return this.userRepository.save(newUser);
-        }catch(Exception e){
-            throw new UsernameAlreadyExistsException("Username '"+newUser.getUsername()+ "' already exists");
-        }
-    }
-
-    @Override
-    public List<String> getAllUsernames() {
-        return this.userRepository.getAllUsernames();
-    }
-
-    @Override
-    public Optional<String> getPassword(UserDto userDto) {
-         this.userRepository.getPassword(userDto.getUsername());
-         return null;
-    }
-
-    @Override
-    public Optional<User> findById(Long id) {
-        return this.userRepository.findById(id);
-    }
-
-}
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/validator/UserValidator.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/validator/UserValidator.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ 	(revision )
@@ -1,26 +1,0 @@
-package finki.diplomska.tripplanner.validator;
-
-import finki.diplomska.tripplanner.models.User;
-import org.springframework.stereotype.Component;
-import org.springframework.validation.Errors;
-import org.springframework.validation.Validator;
-
-
-@Component
-public class UserValidator implements Validator {
-    @Override
-    public boolean supports(Class<?> aClass) {
-        return User.class.equals(aClass);
-    }
-
-    @Override
-    public void validate(Object object, Errors errors) {
-        User user = (User) object;
-        if(user.getPassword().length() < 6){
-            errors.rejectValue("password","Length", "Password must be at least 6 characters" );
-        }
-        if(!user.getPassword().equals(user.getConfirmPassword())){
-           errors.rejectValue("confirmPassword", "Match", "Password must match");
-        }
-    }
-}
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/web/rest/ImagesRestController.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/web/rest/ImagesRestController.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ 	(revision )
@@ -1,23 +1,0 @@
-package finki.diplomska.tripplanner.web.rest;
-
-import finki.diplomska.tripplanner.models.Images;
-import finki.diplomska.tripplanner.service.ImagesService;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-
-@RestController
-@CrossOrigin(origins = "http://localhost:4200")
-@RequestMapping(value = "/api")
-public class ImagesRestController {
-    private final ImagesService imagesService;
-
-    public ImagesRestController(ImagesService imagesService) {
-        this.imagesService = imagesService;
-    }
-
-    @GetMapping(value = "/images")
-    public List<Images> getAllImagesForLocation(@RequestParam Long locationId){
-        return this.imagesService.getAllImagesForLocation(locationId);
-    }
-}
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/web/rest/LocationRestController.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/web/rest/LocationRestController.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ trip-planner/src/main/java/finki/diplomska/tripplanner/web/rest/LocationRestController.java	(revision 6a3a178323fd905112b5392bd9d3cb83b66ef2d3)
@@ -2,11 +2,7 @@
 
 import finki.diplomska.tripplanner.models.Location;
-import finki.diplomska.tripplanner.models.User;
-import finki.diplomska.tripplanner.models.dto.LocationDto;
-import finki.diplomska.tripplanner.models.dto.PlannerLocationDto;
 import finki.diplomska.tripplanner.service.LocationService;
 import finki.diplomska.tripplanner.service.PlannerService;
 import org.springframework.http.ResponseEntity;
-import org.springframework.security.core.Authentication;
 import org.springframework.web.bind.annotation.*;
 
@@ -38,57 +34,16 @@
     }
 
-    @GetMapping(value = "/city/locations")
-    public List<Location> getAllLocationsFromCity(@RequestParam(required = false) Long cityId,
-                                                         @RequestParam(required = false)  Long companionId,
-                                                         @RequestParam(required = false) Long lengthOfStay,
-                                                         @RequestParam(required = false) String categoryIds)  {
-        return this.locationService.findLocationsFromCityForm(cityId, companionId, lengthOfStay, categoryIds);
-
-    }
-
-    @GetMapping(value = "/region/locations")
-    public List<Location> getAllLocationsFromRegion(@RequestParam Long regionId,
-                                                    @RequestParam  Long companionId,
-                                                    @RequestParam Long lengthOfStay,
-                                                    @RequestParam String categoryIds){
-        return this.locationService.findLocationsFromRegionForm(regionId, companionId,lengthOfStay, categoryIds);
-    }
-
-    @PostMapping(value = "/add-location")
-    public Location addLocationToPlanner(@RequestBody PlannerLocationDto plannerLocationDto){
-        return this.locationService.addLocationToPlanner(plannerLocationDto);
-    }
-
-    @GetMapping(value = "/planner/locations")
-    public List<Location> getAllLocationsForPlanner (@RequestParam Long plannerId){
-        return this.locationService.getAllLocationsForPlanner(plannerId);
-    }
-
-    @GetMapping(value = "weekend")
-    public List<Location> getWeekendGetaways(){
-        return this.locationService.getWeekendGetaways();
-    }
-
-    @GetMapping(value = "villages")
-    public List<Location> getVillages(){
-        return this.locationService.getVillages();
-    }
-
-    @GetMapping(value = "/planner/locationIds")
-    public List<Long> getAllLocationIdsForPlanner(@RequestParam Long plannerId){
-        return this.locationService.getAllLocationIdsForPlanner(plannerId);
-    }
-
-    @GetMapping(value = "/all")
-    public List<Location> getAllLocations(@RequestParam String place){
-        return this.locationService.getAllLocations(place);
-    }
-
-    @PostMapping("/add")
-    public ResponseEntity<Location> save(@RequestBody LocationDto locationDto, Authentication authentication) {
-        User user = (User) authentication.getPrincipal();
-        return this.locationService.save(locationDto, user.getUsername())
-                .map(location -> ResponseEntity.ok().body(location))
-                .orElseGet(() -> ResponseEntity.badRequest().build());
+    @PostMapping(value = "/trip/locations")
+    public List<Location> allLocationsAfterSubmittedForm(@RequestParam(required = false) String locName,
+                                                         @RequestParam(required = false)  String companion,
+                                                         @RequestParam(required = false) String region,
+                                                         @RequestParam(required = false) List<String> categories,
+                                                         @RequestParam(required = false)  int numberOfDays)  {
+        List<Location> generatedLocations = this.locationService.scheduleLocations(locName, companion, region, categories, numberOfDays);
+        if(locName.equals("Macedonia")){
+            return generatedLocations;
+        }else{
+            return generatedLocations;
+        }
     }
 }
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/web/rest/PlannerRestController.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/web/rest/PlannerRestController.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ trip-planner/src/main/java/finki/diplomska/tripplanner/web/rest/PlannerRestController.java	(revision 6a3a178323fd905112b5392bd9d3cb83b66ef2d3)
@@ -3,7 +3,5 @@
 import finki.diplomska.tripplanner.models.Location;
 import finki.diplomska.tripplanner.models.Planner;
-import finki.diplomska.tripplanner.models.User;
 import finki.diplomska.tripplanner.models.dto.PlannerDto;
-import finki.diplomska.tripplanner.models.dto.PlannerLocationDto;
 import finki.diplomska.tripplanner.service.LocationService;
 import finki.diplomska.tripplanner.service.PlannerService;
@@ -11,9 +9,7 @@
 import org.springframework.http.MediaType;
 import org.springframework.http.ResponseEntity;
-import org.springframework.security.core.Authentication;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.RestController;
 
-import javax.validation.Valid;
 import java.util.ArrayList;
 import java.util.List;
@@ -21,5 +17,5 @@
 
 @RestController
-@CrossOrigin(origins = "http://localhost:4200",  exposedHeaders = "token")
+@CrossOrigin(origins = "http://localhost:4200")
 @RequestMapping(value = "/api")
 public class PlannerRestController {
@@ -35,11 +31,4 @@
     public List<Planner> getAllPlanners(){
         return this.plannerService.getAllPlaners();
-    }
-
-
-    @GetMapping(value = "/planners/user")
-    public List<Planner> getPlannersByUser(Authentication authentication){
-        User user = (User) authentication.getPrincipal();
-        return this.plannerService.getPlannersByUser(user.getUsername());
     }
 
@@ -68,7 +57,6 @@
     @PostMapping(value = "/planner/new", consumes= MediaType.APPLICATION_JSON_VALUE)
     @ResponseStatus(HttpStatus.CREATED)
-    public ResponseEntity<?> newPlanner(@Valid @RequestBody PlannerDto plannerDto, Authentication authentication)  {
-        User user = (User) authentication.getPrincipal();
-        return this.plannerService.newPlanner(plannerDto, user.getUsername())
+    public ResponseEntity<Planner> newPlanner(@RequestBody PlannerDto plannerDto)  {
+        return this.plannerService.newPlanner(plannerDto)
                 .map(planner -> ResponseEntity.ok().body(planner))
                 .orElseGet(() -> ResponseEntity.badRequest().build());
@@ -77,22 +65,13 @@
 
     @PutMapping(value ="edit/planner/{id}", consumes= MediaType.APPLICATION_JSON_VALUE)
-    public ResponseEntity<Planner> editPlanner(@PathVariable Long id, @Valid @RequestBody PlannerDto plannerDto, Authentication authentication){
-        User user = (User) authentication.getPrincipal();
-        return this.plannerService.editPlanner(id, plannerDto, user.getUsername())
+    public ResponseEntity<Planner> editPlanner(@PathVariable Long id, @RequestBody PlannerDto plannerDto){
+        return this.plannerService.editPlanner(id, plannerDto)
                 .map(planner -> ResponseEntity.ok().body(planner))
                 .orElseGet(()-> ResponseEntity.badRequest().build());
     }
 
-    @DeleteMapping("/delete/{id}")
-    public ResponseEntity deleteById(@PathVariable Long id) {
-        this.plannerService.deletePlannerById(id);
-        return this.plannerService.findById(id)
-                .map(planner -> ResponseEntity.ok().body(planner))
-                .orElseGet(()-> ResponseEntity.notFound().build());
-    }
-
-    @DeleteMapping(value = "/delete-location")
-    public ResponseEntity deleteLocationFromPlanner(@RequestBody PlannerLocationDto plannerLocationDto){
-       return  this.plannerService.deleteLocationFromPlanner(plannerLocationDto);
+    @PutMapping(value = "/add-location")
+    public Planner addLocationToPlanner(@RequestParam Long lid, @RequestParam Long pid){
+        return this.plannerService.addLocationToPlanner(lid, pid);
     }
 }
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/web/rest/RegionRestController.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/web/rest/RegionRestController.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ trip-planner/src/main/java/finki/diplomska/tripplanner/web/rest/RegionRestController.java	(revision 6a3a178323fd905112b5392bd9d3cb83b66ef2d3)
@@ -25,8 +25,3 @@
         return this.regionService.findAll();
     }
-
-    @GetMapping(value = "/places")
-    public List<String> getAllCitiesAndRegions(){
-        return this.regionService.getAllCitiesAndRegions();
-    }
 }
Index: trip-planner/src/main/java/finki/diplomska/tripplanner/web/rest/UserController.java
===================================================================
--- trip-planner/src/main/java/finki/diplomska/tripplanner/web/rest/UserController.java	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ 	(revision )
@@ -1,83 +1,0 @@
-package finki.diplomska.tripplanner.web.rest;
-
-import finki.diplomska.tripplanner.models.User;
-import finki.diplomska.tripplanner.models.dto.UserDto;
-import finki.diplomska.tripplanner.payload.JWTLoginSucessReponse;
-import finki.diplomska.tripplanner.payload.LoginRequest;
-import finki.diplomska.tripplanner.security.JwtTokenProvider;
-import finki.diplomska.tripplanner.security.SecurityConstants;
-import finki.diplomska.tripplanner.service.UserService;
-import finki.diplomska.tripplanner.service.impl.MapValidationErrorService;
-import finki.diplomska.tripplanner.validator.UserValidator;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.security.authentication.AuthenticationManager;
-import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
-import org.springframework.security.core.context.SecurityContextHolder;
-import org.springframework.validation.BindingResult;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.security.core.Authentication;
-
-import javax.validation.Valid;
-import java.util.List;
-import java.util.Optional;
-
-@RestController
-@CrossOrigin(origins = "http://localhost:4200")
-@RequestMapping(value = "/api/users")
-public class UserController {
-
-    @Autowired
-    private MapValidationErrorService mapValidationErrorService;
-
-    @Autowired
-    private UserService userService;
-
-    @Autowired
-    private UserValidator userValidator;
-
-    @Autowired
-    private JwtTokenProvider tokenProvider;
-
-    @Autowired
-    private AuthenticationManager authenticationManager;
-
-    @PostMapping(value = "/login")
-    public ResponseEntity<?> authenticateUser(@Valid @RequestBody LoginRequest loginRequest, BindingResult result){
-        ResponseEntity<?> errorMap = mapValidationErrorService.MapValidationService(result);
-        if(errorMap != null) return errorMap;
-
-        Authentication authentication = authenticationManager.authenticate(
-                new UsernamePasswordAuthenticationToken(
-                        loginRequest.getUsername(),
-                        loginRequest.getPassword()
-                )
-        );
-        SecurityContextHolder.getContext().setAuthentication(authentication);
-        String jwt = SecurityConstants.TOKEN_PREFIX +  tokenProvider.generateToken(authentication);
-        return ResponseEntity.ok(new JWTLoginSucessReponse(true, jwt));
-    }
-
-    @PostMapping(value = "/register")
-    public ResponseEntity<?> registerUser(@Valid @RequestBody User user, BindingResult result){
-        // Validate passwords match
-        userValidator.validate(user, result);
-        ResponseEntity<?> errorMap = mapValidationErrorService.MapValidationService(result);
-        if(errorMap != null)return errorMap;
-        User newUser = userService.saveUser(user);
-        return  new ResponseEntity<User>(newUser, HttpStatus.CREATED);
-    }
-
-    @GetMapping(value = "/usernames")
-    public List<String> getAllUsernames (){
-        return this.userService.getAllUsernames();
-    }
-
-    @GetMapping(value = "/password")
-    public Optional<String> getPassword(@RequestBody UserDto userDto){
-
-        return this.userService.getPassword(userDto);
-    }
-
-}
Index: trip-planner/src/main/resources/application.properties
===================================================================
--- trip-planner/src/main/resources/application.properties	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ trip-planner/src/main/resources/application.properties	(revision 6a3a178323fd905112b5392bd9d3cb83b66ef2d3)
@@ -6,5 +6,4 @@
 jasypt.encryptor.iv-generator-classname=org.jasypt.iv.NoIvGenerator
 jasypt.encryptor.algorithm=PBEWithMD5AndDES
-spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
 
 spring.jpa.show-sql=true
Index: trip-planner/src/main/resources/templates/trip-locations-country.html
===================================================================
--- trip-planner/src/main/resources/templates/trip-locations-country.html	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ trip-planner/src/main/resources/templates/trip-locations-country.html	(revision 6a3a178323fd905112b5392bd9d3cb83b66ef2d3)
@@ -27,5 +27,5 @@
               <span th:text="${loc.getCity().getName()}"/>
             </td>
-             <td><img th:src="*{'data:image/jpeg;base64,'+ imgUtil.getImgData(loc.getPhoto())}" alt="" /></td>
+            <!--  <td><img th:src="*{'data:image/jpeg;base64,'+ imgUtil.getImgData(loc.getPhoto())}" alt="" /></td> -->
 
             <td>
Index: trip-planner/src/main/resources/templates/trip-locations.html
===================================================================
--- trip-planner/src/main/resources/templates/trip-locations.html	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ trip-planner/src/main/resources/templates/trip-locations.html	(revision 6a3a178323fd905112b5392bd9d3cb83b66ef2d3)
@@ -58,5 +58,5 @@
             <td th:text="${loc.getName()}" ></td>
             <td th:text="${loc.getId()}"  ></td>
-        <td><img th:src="*{'data:image/jpeg;base64,'+ imgUtil.getImgData(loc.getPhoto())}" alt="" /></td>
+        <!--    <td><img th:src="*{'data:image/jpeg;base64,'+ imgUtil.getImgData(loc.getPhoto())}" alt="" /></td> -->
             <td class="selectedLocation">
               <a th:href="@{'/create/trip/locations/{id}' (id=${loc.getId()})}" class="btn btn-primary " >Add to planner</a>
Index: trip-planner/src/test/api.http
===================================================================
--- trip-planner/src/test/api.http	(revision 571e0df9a7a5e798c9941a85842f785177bedbbd)
+++ trip-planner/src/test/api.http	(revision 6a3a178323fd905112b5392bd9d3cb83b66ef2d3)
@@ -15,5 +15,5 @@
 Content-Type: application/json
 
-{"name": "Second Planner Check", "description": "Second Planner Description", "locationList" : []}
+{"name": "Sixth Planner Check", "description": "First Planner Description", "locationList" : []}
 
 ###
@@ -30,8 +30,8 @@
 
 ###
-GET http://localhost:8080/api/city/locations?cityId=1&companionId=1&lengthOfStay=1&categoryIds=1,2
+POST http://localhost:8080/api/trip/locations
+Content-Type: application/x-www-form-urlencoded
 
-###
-GET http://localhost:8080/api/region/locations?regionId=1&companionId=1&lengthOfStay=1&categoryIds=1,2
+locName=Macedonia&companion=Wandering Solo&region=Skopje Region&categories=sightseeing&numberOfDays=1
 
 ###
@@ -52,71 +52,5 @@
 ###
 PUT http://localhost:8080/api/add-location
-Content-Type: application/json
-
-{"plannerId": 1, "locationId": 2}
-
-###
-GET http://localhost:8080/api/planner/locations?plannerId=1
 Content-Type: application/x-www-form-urlencoded
 
-###
-GET http://localhost:8080/api/planner/locationIds?plannerId=2
-Content-Type: application/x-www-form-urlencoded
-
-###
-GET http://localhost:8080/api/weekend
-Content-Type: application/x-www-form-urlencoded
-
-###
-GET http://localhost:8080/api/villages
-Content-Type: application/x-www-form-urlencoded
-
-###
-GET http://localhost:8080/api/images?locationId=1
-Content-Type: application/x-www-form-urlencoded
-
-###
-POST http://localhost:8080/api/users/register
-Content-Type: application/json
-
-{"username": "teshht@test.com", "fullName": "nikola", "password" : "nikolce", "confirmPassword": "nikolce"}
-
-###
-POST http://localhost:8080/api/users/login
-Content-Type: application/json
-
-{"username": "test@test.com", "password" : "nikolce"}
-
-
-###
-GET http://localhost:8080/api/planners/user
-Content-Type: application/json
-
-###
-DELETE http://localhost:8080/api/delete-location
-Content-Type: application/json
-
-{"plannerId": 23, "locationId": 3}
-
-###
-GET http://localhost:8080/api/users/usernames
-Content-Type: application/json
-
-###
-GET http://localhost:8080/api/users/password
-Content-Type: application/json
-
-{"username": "ema@test.com"}
-
-###
-GET http://localhost:8080/api/all?place=Skopje
-Content-Type: application/json
-
-
-###
-GET http://localhost:8080/api/places
-Content-Type: application/json
-
-###
-POST http://localhost:8080/api/add
-Content-Type: application/json
+lid=1&pid=1
