Set better path for rest
This commit is contained in:
@@ -10,7 +10,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/locations")
|
@RequestMapping("/progetto152/locations")
|
||||||
public class LocationController {
|
public class LocationController {
|
||||||
private final LocationService locationService;
|
private final LocationService locationService;
|
||||||
|
|
||||||
@@ -19,13 +19,13 @@ public class LocationController {
|
|||||||
this.locationService = locationService;
|
this.locationService = locationService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/get/all")
|
@GetMapping("")
|
||||||
public ResponseEntity<List<LocationEntity>> getAllLocations() {
|
public ResponseEntity<List<LocationEntity>> getAllLocations() {
|
||||||
List<LocationEntity> Locations = locationService.getAllLocations();
|
List<LocationEntity> Locations = locationService.getAllLocations();
|
||||||
return new ResponseEntity<>(Locations, HttpStatus.OK);
|
return new ResponseEntity<>(Locations, HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/get/{id}")
|
@GetMapping("/{id}")
|
||||||
public ResponseEntity<LocationEntity> getLocationById(@PathVariable("id") Long id) {
|
public ResponseEntity<LocationEntity> getLocationById(@PathVariable("id") Long id) {
|
||||||
LocationEntity location = locationService.getLocationById(id);
|
LocationEntity location = locationService.getLocationById(id);
|
||||||
if (location != null) {
|
if (location != null) {
|
||||||
@@ -35,8 +35,8 @@ public class LocationController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/get/name/{name}")
|
@GetMapping("?name={name}")
|
||||||
public ResponseEntity<LocationEntity> getLocationByName(@PathVariable("name") String name) {
|
public ResponseEntity<LocationEntity> getLocationByName(@PathVariable("location") String name) {
|
||||||
LocationEntity location = locationService.getLocationByName(name);
|
LocationEntity location = locationService.getLocationByName(name);
|
||||||
if (location != null) {
|
if (location != null) {
|
||||||
return new ResponseEntity<>(location, HttpStatus.OK);
|
return new ResponseEntity<>(location, HttpStatus.OK);
|
||||||
@@ -45,13 +45,13 @@ public class LocationController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/create/{id}")
|
@PostMapping("")
|
||||||
public ResponseEntity<LocationEntity> createLocation(@RequestBody LocationEntity location) {
|
public ResponseEntity<LocationEntity> createLocation(@RequestBody LocationEntity location) {
|
||||||
LocationEntity createdLocation = locationService.createLocation(location);
|
LocationEntity createdLocation = locationService.createLocation(location);
|
||||||
return new ResponseEntity<>(createdLocation, HttpStatus.CREATED);
|
return new ResponseEntity<>(createdLocation, HttpStatus.CREATED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/put/{id}")
|
@PutMapping("{id}")
|
||||||
public ResponseEntity<LocationEntity> updateLocation(@PathVariable("id") Long id, @RequestBody LocationEntity location) {
|
public ResponseEntity<LocationEntity> updateLocation(@PathVariable("id") Long id, @RequestBody LocationEntity location) {
|
||||||
LocationEntity location1 = locationService.updateLocation(id, location);
|
LocationEntity location1 = locationService.updateLocation(id, location);
|
||||||
if (location1 != null) {
|
if (location1 != null) {
|
||||||
@@ -61,7 +61,7 @@ public class LocationController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping("/delete/{id}")
|
@DeleteMapping("{id}")
|
||||||
public ResponseEntity<Void> deleteLocation(@PathVariable("id") Long id) {
|
public ResponseEntity<Void> deleteLocation(@PathVariable("id") Long id) {
|
||||||
boolean deleted = locationService.deleteLocation(id);
|
boolean deleted = locationService.deleteLocation(id);
|
||||||
if (deleted) {
|
if (deleted) {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/users")
|
@RequestMapping("/progetto152/users")
|
||||||
public class UserController {
|
public class UserController {
|
||||||
|
|
||||||
private final UserService userService;
|
private final UserService userService;
|
||||||
@@ -21,13 +21,13 @@ public class UserController {
|
|||||||
this.userService = userService;
|
this.userService = userService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/get/all")
|
@GetMapping("")
|
||||||
public ResponseEntity<List<UserEntity>> getAllUsers() {
|
public ResponseEntity<List<UserEntity>> getAllUsers() {
|
||||||
List<UserEntity> users = userService.getAllUsers();
|
List<UserEntity> users = userService.getAllUsers();
|
||||||
return new ResponseEntity<>(users, HttpStatus.OK);
|
return new ResponseEntity<>(users, HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/get/{id}")
|
@GetMapping("/{id}")
|
||||||
public ResponseEntity<UserEntity> getUserById(@PathVariable("id") Long id) {
|
public ResponseEntity<UserEntity> getUserById(@PathVariable("id") Long id) {
|
||||||
UserEntity user = userService.getUserById(id);
|
UserEntity user = userService.getUserById(id);
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
@@ -37,7 +37,7 @@ public class UserController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/get/name/{name}")
|
@GetMapping("?name={name}")
|
||||||
public ResponseEntity<UserEntity> getUserByName(@PathVariable("name") String name) {
|
public ResponseEntity<UserEntity> getUserByName(@PathVariable("name") String name) {
|
||||||
UserEntity user = userService.getUserByName(name);
|
UserEntity user = userService.getUserByName(name);
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
@@ -47,7 +47,7 @@ public class UserController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/get/username/{username}")
|
@GetMapping("?username={username}")
|
||||||
public ResponseEntity<UserEntity> getUserByUsername(@PathVariable("username") String username) {
|
public ResponseEntity<UserEntity> getUserByUsername(@PathVariable("username") String username) {
|
||||||
UserEntity user = userService.getUserByUsername(username);
|
UserEntity user = userService.getUserByUsername(username);
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
@@ -57,13 +57,13 @@ public class UserController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/create/{id}")
|
@PostMapping("")
|
||||||
public ResponseEntity<UserEntity> createUser(@RequestBody UserEntity user) {
|
public ResponseEntity<UserEntity> createUser(@RequestBody UserEntity user) {
|
||||||
UserEntity createdUser = userService.createUser(user);
|
UserEntity createdUser = userService.createUser(user);
|
||||||
return new ResponseEntity<>(createdUser, HttpStatus.CREATED);
|
return new ResponseEntity<>(createdUser, HttpStatus.CREATED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/put/{id}")
|
@PutMapping("/{id}")
|
||||||
public ResponseEntity<UserEntity> updateUser(@PathVariable("id") Long id, @RequestBody UserEntity user) {
|
public ResponseEntity<UserEntity> updateUser(@PathVariable("id") Long id, @RequestBody UserEntity user) {
|
||||||
UserEntity updatedUser = userService.updateUser(id, user);
|
UserEntity updatedUser = userService.updateUser(id, user);
|
||||||
if (updatedUser != null) {
|
if (updatedUser != null) {
|
||||||
@@ -73,7 +73,7 @@ public class UserController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping("/delete/{id}")
|
@DeleteMapping("/{id}")
|
||||||
public ResponseEntity<Void> deleteUser(@PathVariable("id") Long id) {
|
public ResponseEntity<Void> deleteUser(@PathVariable("id") Long id) {
|
||||||
boolean deleted = userService.deleteUser(id);
|
boolean deleted = userService.deleteUser(id);
|
||||||
if (deleted) {
|
if (deleted) {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/waypoints")
|
@RequestMapping("/progetto152/waypoints")
|
||||||
public class WaypointController {
|
public class WaypointController {
|
||||||
private final WaypointService waypointService;
|
private final WaypointService waypointService;
|
||||||
|
|
||||||
@@ -19,13 +19,13 @@ public class WaypointController {
|
|||||||
this.waypointService = waypointService;
|
this.waypointService = waypointService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/get/all")
|
@GetMapping("")
|
||||||
public ResponseEntity<List<WaypointsEntity>> getAllWaypoints() {
|
public ResponseEntity<List<WaypointsEntity>> getAllWaypoints() {
|
||||||
List<WaypointsEntity> waypoint = waypointService.getAllWaypoints();
|
List<WaypointsEntity> waypoint = waypointService.getAllWaypoints();
|
||||||
return new ResponseEntity<>(waypoint, HttpStatus.OK);
|
return new ResponseEntity<>(waypoint, HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/get/{id}")
|
@GetMapping("/{id}")
|
||||||
public ResponseEntity<WaypointsEntity> getWaypointById(@PathVariable("id") Long id) {
|
public ResponseEntity<WaypointsEntity> getWaypointById(@PathVariable("id") Long id) {
|
||||||
WaypointsEntity waypoint = waypointService.getWaypointById(id);
|
WaypointsEntity waypoint = waypointService.getWaypointById(id);
|
||||||
if (waypoint != null) {
|
if (waypoint != null) {
|
||||||
@@ -35,7 +35,7 @@ public class WaypointController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/get/name/{name}")
|
@GetMapping("?name={name}")
|
||||||
public ResponseEntity<WaypointsEntity> getWaypointByName(@PathVariable("name") String name) {
|
public ResponseEntity<WaypointsEntity> getWaypointByName(@PathVariable("name") String name) {
|
||||||
WaypointsEntity waypoint = waypointService.getWaypointByName(name);
|
WaypointsEntity waypoint = waypointService.getWaypointByName(name);
|
||||||
if (waypoint != null) {
|
if (waypoint != null) {
|
||||||
@@ -45,13 +45,13 @@ public class WaypointController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/create/{id}")
|
@PostMapping("")
|
||||||
public ResponseEntity<WaypointsEntity> createWaypoint(@RequestBody WaypointsEntity waypoint) {
|
public ResponseEntity<WaypointsEntity> createWaypoint(@RequestBody WaypointsEntity waypoint) {
|
||||||
WaypointsEntity createdWaypoint = waypointService.createWaypoint(waypoint);
|
WaypointsEntity createdWaypoint = waypointService.createWaypoint(waypoint);
|
||||||
return new ResponseEntity<>(createdWaypoint, HttpStatus.CREATED);
|
return new ResponseEntity<>(createdWaypoint, HttpStatus.CREATED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/put/{id}")
|
@PutMapping("/{id}")
|
||||||
public ResponseEntity<WaypointsEntity> updateWaypoint(@PathVariable("id") Long id, @RequestBody WaypointsEntity waypoint) {
|
public ResponseEntity<WaypointsEntity> updateWaypoint(@PathVariable("id") Long id, @RequestBody WaypointsEntity waypoint) {
|
||||||
WaypointsEntity updatedWaypoint = waypointService.updateWaypoint(id, waypoint);
|
WaypointsEntity updatedWaypoint = waypointService.updateWaypoint(id, waypoint);
|
||||||
if (updatedWaypoint != null) {
|
if (updatedWaypoint != null) {
|
||||||
@@ -61,7 +61,7 @@ public class WaypointController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping("/delete/{id}")
|
@DeleteMapping("/{id}")
|
||||||
public ResponseEntity<Void> deleteWaypoint(@PathVariable("id") Long id) {
|
public ResponseEntity<Void> deleteWaypoint(@PathVariable("id") Long id) {
|
||||||
boolean deleted = waypointService.deleteWaypoint(id);
|
boolean deleted = waypointService.deleteWaypoint(id);
|
||||||
if (deleted) {
|
if (deleted) {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/users")
|
@RequestMapping("/progetto152/waypointsvisited")
|
||||||
public class WaypointVisitedController {
|
public class WaypointVisitedController {
|
||||||
private final WaypointVisitedService waypointVisitedService;
|
private final WaypointVisitedService waypointVisitedService;
|
||||||
|
|
||||||
@@ -19,13 +19,13 @@ public class WaypointVisitedController {
|
|||||||
this.waypointVisitedService = waypointVisitedService;
|
this.waypointVisitedService = waypointVisitedService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/get/all")
|
@GetMapping("")
|
||||||
public ResponseEntity<List<WaypointsVisitedEntity>> getAllWaypointsVisited() {
|
public ResponseEntity<List<WaypointsVisitedEntity>> getAllWaypointsVisited() {
|
||||||
List<WaypointsVisitedEntity> waypointVisited = waypointVisitedService.getAllWaypointsVisited();
|
List<WaypointsVisitedEntity> waypointVisited = waypointVisitedService.getAllWaypointsVisited();
|
||||||
return new ResponseEntity<>(waypointVisited, HttpStatus.OK);
|
return new ResponseEntity<>(waypointVisited, HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/get/{id}")
|
@GetMapping("/{id}")
|
||||||
public ResponseEntity<WaypointsVisitedEntity> getWaypointVisitedById(@PathVariable("id") Long id) {
|
public ResponseEntity<WaypointsVisitedEntity> getWaypointVisitedById(@PathVariable("id") Long id) {
|
||||||
WaypointsVisitedEntity waypointVisited = waypointVisitedService.getWaypointById(id);
|
WaypointsVisitedEntity waypointVisited = waypointVisitedService.getWaypointById(id);
|
||||||
if (waypointVisited != null) {
|
if (waypointVisited != null) {
|
||||||
@@ -35,7 +35,7 @@ public class WaypointVisitedController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/get/name/{id}")
|
@GetMapping("?userid={id}")
|
||||||
public ResponseEntity<WaypointsVisitedEntity> getWaypointVisitedByUserId(@PathVariable("id") Long id) {
|
public ResponseEntity<WaypointsVisitedEntity> getWaypointVisitedByUserId(@PathVariable("id") Long id) {
|
||||||
WaypointsVisitedEntity waypointVisited = waypointVisitedService.getWaypointsVisitedByUserId(id);
|
WaypointsVisitedEntity waypointVisited = waypointVisitedService.getWaypointsVisitedByUserId(id);
|
||||||
if (waypointVisited != null) {
|
if (waypointVisited != null) {
|
||||||
@@ -45,7 +45,7 @@ public class WaypointVisitedController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/get/name/{id}")
|
@GetMapping("?waypointid={id}")
|
||||||
public ResponseEntity<WaypointsVisitedEntity> getWaypointVisitedByWaypointId(@PathVariable("id") Long id) {
|
public ResponseEntity<WaypointsVisitedEntity> getWaypointVisitedByWaypointId(@PathVariable("id") Long id) {
|
||||||
WaypointsVisitedEntity waypointVisited = waypointVisitedService.getWaypointsVisitedByWaypointId(id);
|
WaypointsVisitedEntity waypointVisited = waypointVisitedService.getWaypointsVisitedByWaypointId(id);
|
||||||
if (waypointVisited != null) {
|
if (waypointVisited != null) {
|
||||||
@@ -55,13 +55,13 @@ public class WaypointVisitedController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/create/{id}")
|
@PostMapping("")
|
||||||
public ResponseEntity<WaypointsVisitedEntity> createWaypointVisited(@RequestBody WaypointsVisitedEntity waypointVisited) {
|
public ResponseEntity<WaypointsVisitedEntity> createWaypointVisited(@RequestBody WaypointsVisitedEntity waypointVisited) {
|
||||||
WaypointsVisitedEntity createdWaypoint = waypointVisitedService.createWaypoint(waypointVisited);
|
WaypointsVisitedEntity createdWaypoint = waypointVisitedService.createWaypoint(waypointVisited);
|
||||||
return new ResponseEntity<>(createdWaypoint, HttpStatus.CREATED);
|
return new ResponseEntity<>(createdWaypoint, HttpStatus.CREATED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/put/{id}")
|
@PutMapping("/{id}")
|
||||||
public ResponseEntity<WaypointsVisitedEntity> updateWaypointVisited(@PathVariable("id") Long id, @RequestBody WaypointsVisitedEntity waypointVisited) {
|
public ResponseEntity<WaypointsVisitedEntity> updateWaypointVisited(@PathVariable("id") Long id, @RequestBody WaypointsVisitedEntity waypointVisited) {
|
||||||
WaypointsVisitedEntity updatedWaypoint = waypointVisitedService.updateWaypoint(id, waypointVisited);
|
WaypointsVisitedEntity updatedWaypoint = waypointVisitedService.updateWaypoint(id, waypointVisited);
|
||||||
if (updatedWaypoint != null) {
|
if (updatedWaypoint != null) {
|
||||||
@@ -71,7 +71,7 @@ public class WaypointVisitedController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping("/delete/{id}")
|
@DeleteMapping("/{id}")
|
||||||
public ResponseEntity<Void> deleteWaypointVisited(@PathVariable("id") Long id) {
|
public ResponseEntity<Void> deleteWaypointVisited(@PathVariable("id") Long id) {
|
||||||
boolean deleted = waypointVisitedService.deleteWaypoint(id);
|
boolean deleted = waypointVisitedService.deleteWaypoint(id);
|
||||||
if (deleted) {
|
if (deleted) {
|
||||||
|
|||||||
Reference in New Issue
Block a user