- Timestamp:
- 01/24/22 21:08:32 (3 years ago)
- Branches:
- master
- Children:
- 76712b2
- Parents:
- bdd6491
- Location:
- trip-planner/src/main/java/finki/diplomska/tripplanner/web/rest
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trip-planner/src/main/java/finki/diplomska/tripplanner/web/rest/LocationRestController.java
rbdd6491 rb738035 45 45 46 46 @GetMapping(value = "/region/locations") 47 public List<Location> getAllLocationsFromRegion(@RequestParam (required = false)Long regionId,48 @RequestParam (required = false)Long companionId,49 @RequestParam (required = false)Long lengthOfStay,50 @RequestParam (required = false)String categoryIds){47 public List<Location> getAllLocationsFromRegion(@RequestParam Long regionId, 48 @RequestParam Long companionId, 49 @RequestParam Long lengthOfStay, 50 @RequestParam String categoryIds){ 51 51 return this.locationService.findLocationsFromRegionForm(regionId, companionId,lengthOfStay, categoryIds); 52 52 } 53 53 54 @P utMapping(value = "/add-location")54 @PostMapping(value = "/add-location") 55 55 public Location addLocationToPlanner(@RequestBody PlannerLocationDto plannerLocationDto){ 56 56 return this.locationService.addLocationToPlanner(plannerLocationDto); -
trip-planner/src/main/java/finki/diplomska/tripplanner/web/rest/PlannerRestController.java
rbdd6491 rb738035 5 5 import finki.diplomska.tripplanner.models.User; 6 6 import finki.diplomska.tripplanner.models.dto.PlannerDto; 7 import finki.diplomska.tripplanner.models.dto.PlannerLocationDto; 7 8 import finki.diplomska.tripplanner.service.LocationService; 8 9 import finki.diplomska.tripplanner.service.PlannerService; … … 92 93 } 93 94 94 95 @DeleteMapping(value = "/delete-from-planner") 96 public ResponseEntity deleteLocationFromPlanner(@PathVariable Long locationId){ 97 this.plannerService.deleteLocationFromPlanner(locationId); 98 return this.locationService.findById(locationId) 99 .map(location -> ResponseEntity.ok().body(location)) 100 .orElseGet(()-> ResponseEntity.notFound().build()); 95 @DeleteMapping(value = "/delete-location") 96 public ResponseEntity deleteLocationFromPlanner(@RequestBody PlannerLocationDto plannerLocationDto){ 97 return this.plannerService.deleteLocationFromPlanner(plannerLocationDto); 101 98 } 102 99 } -
trip-planner/src/main/java/finki/diplomska/tripplanner/web/rest/UserController.java
rbdd6491 rb738035 19 19 import org.springframework.web.bind.annotation.*; 20 20 import org.springframework.security.core.Authentication; 21 21 22 import javax.validation.Valid; 23 import java.util.List; 24 import java.util.Optional; 22 25 23 26 @RestController … … 52 55 ) 53 56 ); 54 55 57 SecurityContextHolder.getContext().setAuthentication(authentication); 56 58 String jwt = SecurityConstants.TOKEN_PREFIX + tokenProvider.generateToken(authentication); 57 58 59 return ResponseEntity.ok(new JWTLoginSucessReponse(true, jwt)); 59 60 } … … 65 66 ResponseEntity<?> errorMap = mapValidationErrorService.MapValidationService(result); 66 67 if(errorMap != null)return errorMap; 68 User newUser = userService.saveUser(user); 69 return new ResponseEntity<User>(newUser, HttpStatus.CREATED); 70 } 67 71 68 User newUser = userService.saveUser(user); 72 @GetMapping(value = "/usernames") 73 public List<String> getAllUsernames (){ 74 return this.userService.getAllUsernames(); 75 } 69 76 70 return new ResponseEntity<User>(newUser, HttpStatus.CREATED); 77 @GetMapping(value = "/password") 78 public Optional<String> getPassword(@RequestBody UserDto userDto){ 71 79 80 return this.userService.getPassword(userDto); 72 81 } 82 73 83 }
Note:
See TracChangeset
for help on using the changeset viewer.