API 1.0.16 CustomerExerciseDevice.delete fix
This commit is contained in:
@@ -33,10 +33,12 @@ class CustomerExerciseDeviceController(private val customerExerciseDeviceReposit
|
||||
}
|
||||
|
||||
@Secured
|
||||
@PostMapping("/customer_exercise_device/delete/")
|
||||
fun deleteCustomerExerciseDevice(@Valid @RequestBody customerExerciseDevice: CustomerExerciseDevice) :ResponseEntity<HttpStatus> {
|
||||
val returnDevice = customerExerciseDeviceRepository.findById(customerExerciseDevice.customerExerciseDeviceId).orElse(null)
|
||||
?: return ResponseEntity.notFound().build()
|
||||
@PostMapping("/customer_exercise_device/delete/{id}")
|
||||
fun deleteCustomerExerciseDevice(@PathVariable(value = "id") customerExerciseDeviceId: Long) :ResponseEntity<HttpStatus> {
|
||||
logger.info("Delete device by ID: $customerExerciseDeviceId")
|
||||
val returnDevice = customerExerciseDeviceRepository.findById(customerExerciseDeviceId).orElse(null)
|
||||
?: return ResponseEntity.notFound().build()
|
||||
|
||||
try {
|
||||
customerExerciseDeviceRepository.delete(returnDevice)
|
||||
} catch (e: IllegalArgumentException ) {
|
||||
|
||||
@@ -10,7 +10,7 @@ import javax.validation.constraints.NotNull
|
||||
data class CustomerExerciseDevice (
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
val customerExerciseDeviceId: Long = 0,
|
||||
var customerExerciseDeviceId: Long = 0,
|
||||
@get: NotNull var exerciseDeviceId: Long?,
|
||||
@get: NotNull var customerId: Long?,
|
||||
@get: NotNull var favourite: Boolean?,
|
||||
|
||||
Reference in New Issue
Block a user