Changeset 59329aa for trip-planner/src
- Timestamp:
- 11/23/21 14:58:44 (3 years ago)
- Branches:
- master
- Children:
- e29cc2e
- Parents:
- ceaed42
- Location:
- trip-planner/src
- Files:
-
- 5 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trip-planner/src/main/java/finki/diplomska/tripplanner/models/Location.java
rceaed42 r59329aa 2 2 3 3 import com.fasterxml.jackson.annotation.JsonBackReference; 4 import com.fasterxml.jackson.annotation.JsonManagedReference; 4 5 import lombok.AllArgsConstructor; 5 6 import lombok.Getter; … … 72 73 73 74 75 @OneToMany(mappedBy = "location", cascade = CascadeType.REMOVE, orphanRemoval = true) 76 @JsonManagedReference 77 private List<Images> imagesList; 78 79 74 80 } -
trip-planner/src/main/java/finki/diplomska/tripplanner/repository/jpa/JpaLocationRepository.java
rceaed42 r59329aa 83 83 "(SELECT pl.id_location FROM planners_contain AS pl WHERE pl.id_planner = :plannerId)", nativeQuery = true) 84 84 List<Location> getAllLocationsForPlanner(@Param("plannerId") Long plannerId); 85 86 @Query(value = "SELECT *, if(l.id_city is NOT NULL, c.city_name, l.location_name) as result " + 87 "FROM locations AS l " + 88 "LEFT JOIN cities AS c " + 89 "ON l.id_city = c.id_city " + 90 "LEFT JOIN locations_belong AS lb " + 91 "ON l.id_location = lb.id_location " + 92 "WHERE lb.id_category=20", nativeQuery = true) 93 List<Location> getWeekendGetaways(); 94 95 @Query(value = "SELECT *, if(l.id_city is NOT NULL, c.city_name, l.location_name) as result " + 96 "FROM locations AS l " + 97 "LEFT JOIN cities AS c " + 98 "ON l.id_city = c.id_city " + 99 "LEFT JOIN locations_belong AS lb " + 100 "ON l.id_location = lb.id_location " + 101 "WHERE lb.id_category=4", nativeQuery = true) 102 List<Location> getVillages(); 85 103 } -
trip-planner/src/main/java/finki/diplomska/tripplanner/service/LocationService.java
rceaed42 r59329aa 21 21 Location addLocationToPlanner(PlannerLocationDto plannerLocationDto); 22 22 List<Location> getAllLocationsForPlanner(Long plannerId); 23 23 List<Location> getWeekendGetaways(); 24 List<Location> getVillages(); 24 25 } -
trip-planner/src/main/java/finki/diplomska/tripplanner/service/impl/LocationServiceImpl.java
rceaed42 r59329aa 169 169 } 170 170 171 @Override 172 public List<Location> getWeekendGetaways() { 173 return this.locationRepository.getWeekendGetaways(); 174 } 175 176 @Override 177 public List<Location> getVillages() { 178 return this.locationRepository.getVillages(); 179 } 180 171 181 172 182 } -
trip-planner/src/main/java/finki/diplomska/tripplanner/web/rest/LocationRestController.java
rceaed42 r59329aa 61 61 return this.locationService.getAllLocationsForPlanner(plannerId); 62 62 } 63 64 @GetMapping(value = "weekend") 65 public List<Location> getWeekendGetaways(){ 66 return this.locationService.getWeekendGetaways(); 67 } 68 69 @GetMapping(value = "villages") 70 public List<Location> getVillages(){ 71 return this.locationService.getVillages(); 72 } 63 73 } -
trip-planner/src/main/resources/templates/trip-locations-country.html
rceaed42 r59329aa 27 27 <span th:text="${loc.getCity().getName()}"/> 28 28 </td> 29 <!-- <td><img th:src="*{'data:image/jpeg;base64,'+ imgUtil.getImgData(loc.getPhoto())}" alt="" /></td> -->29 <td><img th:src="*{'data:image/jpeg;base64,'+ imgUtil.getImgData(loc.getPhoto())}" alt="" /></td> 30 30 31 31 <td> -
trip-planner/src/main/resources/templates/trip-locations.html
rceaed42 r59329aa 58 58 <td th:text="${loc.getName()}" ></td> 59 59 <td th:text="${loc.getId()}" ></td> 60 < !-- <td><img th:src="*{'data:image/jpeg;base64,'+ imgUtil.getImgData(loc.getPhoto())}" alt="" /></td> -->60 <td><img th:src="*{'data:image/jpeg;base64,'+ imgUtil.getImgData(loc.getPhoto())}" alt="" /></td> 61 61 <td class="selectedLocation"> 62 62 <a th:href="@{'/create/trip/locations/{id}' (id=${loc.getId()})}" class="btn btn-primary " >Add to planner</a> -
trip-planner/src/test/api.http
rceaed42 r59329aa 60 60 Content-Type: application/x-www-form-urlencoded 61 61 62 ### 63 GET http://localhost:8080/api/weekend 64 Content-Type: application/x-www-form-urlencoded 65 66 ### 67 GET http://localhost:8080/api/villages 68 Content-Type: application/x-www-form-urlencoded 69 70 ### 71 GET http://localhost:8080/api/images?locationId=1 72 Content-Type: application/x-www-form-urlencoded
Note:
See TracChangeset
for help on using the changeset viewer.