|
@@ -24,16 +24,12 @@ public class PlantManagementController {
|
|
|
|
|
|
|
|
@PostMapping
|
|
@PostMapping
|
|
|
public ResponseEntity addNewPlant(@RequestBody Plant plant){
|
|
public ResponseEntity addNewPlant(@RequestBody Plant plant){
|
|
|
- if(plantService.getAllPlants().contains(plant))
|
|
|
|
|
- return new ResponseEntity(HttpStatus.NOT_ACCEPTABLE);
|
|
|
|
|
plantService.addPlant(plant);
|
|
plantService.addPlant(plant);
|
|
|
return new ResponseEntity(HttpStatus.OK);
|
|
return new ResponseEntity(HttpStatus.OK);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@DeleteMapping(path = "{plantID}")
|
|
@DeleteMapping(path = "{plantID}")
|
|
|
public ResponseEntity deletePlant(@PathVariable("plantID") Long plantID){
|
|
public ResponseEntity deletePlant(@PathVariable("plantID") Long plantID){
|
|
|
- if(plantService.findPlantById(plantID).isEmpty())
|
|
|
|
|
- return new ResponseEntity(HttpStatus.NOT_ACCEPTABLE);
|
|
|
|
|
plantService.delete(plantID);
|
|
plantService.delete(plantID);
|
|
|
return new ResponseEntity(HttpStatus.OK);
|
|
return new ResponseEntity(HttpStatus.OK);
|
|
|
}
|
|
}
|