exercise_plan_detail_id in exercises

This commit is contained in:
Bossanyi Tibor
2020-09-14 23:32:13 +02:00
parent efe7dea584
commit 3f8eb6ef00
11 changed files with 27 additions and 45 deletions
@@ -54,11 +54,10 @@ class ExercisePlanController( private val exercisePlanRepository: ExercisePlanRe
@Secured
@PostMapping("/exercise_plan/delete/{exercisePlanId}")
fun deleteExercisePlanById(@PathVariable(value = "exercisePlanId") exercisePlanId: Int,
@Valid @RequestBody exercisePlan: ExercisePlan)
fun deleteExercisePlanById(@PathVariable(value = "exercisePlanId") exercisePlanId: Int)
:ResponseEntity<HttpStatus> {
val returnPlan = exercisePlanRepository.findById(exercisePlanId).orElse(null)
?: return ResponseEntity.ok().body(HttpStatus.NOT_FOUND)
?: return ResponseEntity.notFound().build()
try {
exercisePlanRepository.delete(returnPlan)
} catch (e: IllegalArgumentException ) {
@@ -22,15 +22,6 @@ class ExercisePlanDetailController( private val exercisePlanDetailRepository: Ex
return ResponseEntity.ok().body(exercisePlanDetailRepository.save(exercisePlanDetail))
}
/* @GetMapping("/exercise_plan_detail/last/{customerId}")
fun getExercisePlanByCustomerId(@PathVariable(value = "customerId") customerId: Long): ResponseEntity<List<ExercisePlanDetail>> {
val list: List<ExercisePlanDetail> = exercisePlanDetailRepository.getLastExercisePlanDetail(customerId)
logger.info("-- getExercisePlanByCustomerId id: $customerId -- $list")
return ResponseEntity.ok().body(list)
}
*/
@GetMapping("/exercise_plan_detail/{exercisePlanId}")
fun getExercisePlanByExercisePlanId(@PathVariable(value = "exercisePlanId") exercisePlanId: Int): ResponseEntity<List<ExercisePlanDetail>> {
val list: List<ExercisePlanDetail> = exercisePlanDetailRepository.findByExercisePlanId(exercisePlanId)
@@ -61,11 +52,10 @@ class ExercisePlanDetailController( private val exercisePlanDetailRepository: Ex
@Secured
@PostMapping("/exercise_plan_detail/delete/{exercisePlanDetailId}")
fun deleteExercisePlanDetailById(@PathVariable(value = "exercisePlanDetailId") exercisePlanDetailId: Long,
@Valid @RequestBody exercisePlanDetail: ExercisePlanDetail)
fun deleteExercisePlanDetailById(@PathVariable(value = "exercisePlanDetailId") exercisePlanDetailId: Long)
:ResponseEntity<HttpStatus> {
val returnPlanDetail = exercisePlanDetailRepository.findById(exercisePlanDetailId).orElse(null)
?: return ResponseEntity.ok().body(HttpStatus.NOT_FOUND)
?: return ResponseEntity.notFound().build()
try {
exercisePlanDetailRepository.delete(returnPlanDetail)
} catch (e: IllegalArgumentException ) {
@@ -16,6 +16,7 @@ data class Exercises (
@get: Null var restTime: Int?, // in seconds
@get: NonNull var unit: String? = null,
@get: NonNull var unitQuantity: Double? = null,
@get: NonNull var exercisePlanDetailId: Int = 0,
@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
val exerciseId: Long = 0
@@ -16,6 +16,6 @@ logging.config=classpath:logback-spring.xml
logging.file=logs
# if the database structure has been changed, increment this version number
application.version=1.0.8
application.version=1.0.9
jwt.secret=aitrainer
@@ -1,21 +0,0 @@
spring.profiles.active=prod
## Spring DATASOURCE (DataSourceAutoConfiguration & DataSourceProperties)
spring.datasource.url = jdbc:mysql://62.171.188.119:33060/aitrainer_test?serverTimezone=CET&useSSL=false&characterEncoding=UTF-8&allowPublicKeyRetrieval=true&allowMultiQueries=true
spring.datasource.username = aitrainer
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
logging.config=classpath:logback-spring.xml
logging.file=logs
# if the database structure has been changed, increment this version number
application.version=1.0.8
jwt.secret=aitrainer
+1 -1
View File
@@ -16,6 +16,6 @@ logging.config=classpath:logback-spring.xml
logging.file=logs
# if the database structure has been changed, increment this version number
application.version=1.0.8
application.version=1.0.9
jwt.secret=aitrainer