API 1.2.3 meal normalized name, serving

This commit is contained in:
Tibor Bossanyi
2023-04-12 20:10:38 +02:00
parent c3bc18fda5
commit 50028cbcec
12 changed files with 100 additions and 14 deletions
@@ -40,4 +40,12 @@ class DietUserConsumptionController(private val dietUserConsumptionRepository: D
return if (list.isEmpty()) ResponseEntity.notFound().build() else
ResponseEntity.ok().body(list)
}
@PostMapping("/diet_user_consumption/delete/{id}")
fun delete(@PathVariable id: Long): ResponseEntity<*> {
return dietUserConsumptionRepository.findById(id).map { existingConsumption ->
dietUserConsumptionRepository.delete(existingConsumption)
ResponseEntity.ok().body("OK")
}.orElse(ResponseEntity.notFound().build())
}
}
@@ -11,6 +11,9 @@ data class DietMeal (
@Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Expose val id: Long = 0,
@Expose @get: NotNull val mealId: Long = 0,
@Expose @get: NotNull val mealName: String = "",
@Expose @get: NotNull val normalizedName: String = "",
@Expose @get: NotNull val serving: Double = 0.0,
@Expose @get: NotNull val servingUnit: String = "",
@Expose @get: NotNull val meal: String = "",
@Expose @get: NotNull var quantity: Double = 0.0,
@Expose @get: NotNull val quantityUnit: String = "",
@@ -8,8 +8,11 @@ data class Meal (
@Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Expose val id: Long = 0,
@Expose @get: NotNull val name: String = "",
@Expose @get: NotNull val normalizedName: String = "",
@Expose @get: NotNull val quantity: Double = 0.0,
@Expose @get: NotNull val quantityUnit: String = "",
@Expose @get: NotNull val serving: Double = 0.0,
@Expose @get: NotNull val servingUnit: String = "",
@Expose @get: NotNull val description: String = "",
@Expose @get: NotNull val calMin: Double = 0.0,
@Expose @get: NotNull val calMax: Double = 0.0,
@@ -16,7 +16,7 @@ logging.config=classpath:logback-spring.xml
logging.file=logs
# if the database structure has been changed, increment this version number
application.version=1.2.2
application.version=1.2.3
jwt.secret=aitrainer
@@ -14,7 +14,7 @@ logging.config=classpath:logback-spring.xml
logging.file=logs
# if the database structue has been changed, increment this version number
application.version=1.2.2
application.version=1.2.3
jwt.secret=aitrainer
@@ -14,7 +14,7 @@ logging.config=classpath:logback-spring.xml
logging.file=logs
# if the database structue has been changed, increment this version number
application.version=1.2.2
application.version=1.2.3
jwt.secret=aitrainer
+1 -1
View File
@@ -17,7 +17,7 @@ logging.config=classpath:logback-spring.xml
logging.file=logs
# if the database structure has been changed, increment this version number
application.version=1.2.2
application.version=1.2.3
jwt.secret=aitrainer