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?,
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
spring.profiles.active=testmac
|
||||
## Spring DATASOURCE (DataSourceAutoConfiguration & DataSourceProperties)
|
||||
#spring.datasource.url = jdbc:mysql://localhost:3306/aitrainer?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&useSSL=false
|
||||
spring.datasource.url = jdbc:mysql://127.0.0.1:3306/aitrainer2?serverTimezone=CET&useSSL=false&characterEncoding=UTF-8&allowPublicKeyRetrieval=true&allowMultiQueries=true
|
||||
spring.datasource.username = root
|
||||
spring.datasource.password = andio2009
|
||||
|
||||
|
||||
## Hibernate Properties
|
||||
|
||||
|
||||
# The SQL dialect makes Hibernate generate better SQL for the chosen database
|
||||
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5InnoDBDialect
|
||||
Reference in New Issue
Block a user