exercise_plan_detail_id in exercises
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user