Ignore:
Timestamp:
12/28/21 08:56:55 (3 years ago)
Author:
Ema <ema_spirova@…>
Branches:
master
Children:
b738035
Parents:
84d0fbb
Message:

pre final presentation

Location:
trip-planner/src/main/java/finki/diplomska/tripplanner/web/rest
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trip-planner/src/main/java/finki/diplomska/tripplanner/web/rest/LocationRestController.java

    r84d0fbb rbdd6491  
    55import finki.diplomska.tripplanner.service.LocationService;
    66import finki.diplomska.tripplanner.service.PlannerService;
    7 import org.springframework.data.repository.query.Param;
    87import org.springframework.http.ResponseEntity;
    98import org.springframework.web.bind.annotation.*;
     
    7776        return this.locationService.getAllLocationIdsForPlanner(plannerId);
    7877    }
     78
    7979}
  • trip-planner/src/main/java/finki/diplomska/tripplanner/web/rest/PlannerRestController.java

    r84d0fbb rbdd6491  
    8484    }
    8585
     86    @DeleteMapping("/delete/{id}")
     87    public ResponseEntity deleteById(@PathVariable Long id) {
     88        this.plannerService.deletePlannerById(id);
     89        return this.plannerService.findById(id)
     90                .map(planner -> ResponseEntity.ok().body(planner))
     91                .orElseGet(()-> ResponseEntity.notFound().build());
     92    }
    8693
     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());
     101    }
    87102}
Note: See TracChangeset for help on using the changeset viewer.