Correction d'un bug qui empêchait de modifier les étapes d'une recette.

This commit is contained in:
FyloZ 2021-03-26 15:46:47 -04:00
parent e54ed1408e
commit 3987b18fdd
3 changed files with 10 additions and 5 deletions

View File

@ -146,7 +146,7 @@ data class RecipeGroupInformation(
@OneToMany(cascade = [CascadeType.ALL], fetch = FetchType.EAGER, orphanRemoval = true)
@JoinColumn(name = "recipe_group_information_id")
var steps: Set<RecipeStep>?
var steps: MutableSet<RecipeStep>?
)
data class RecipeStepsDto(
@ -230,7 +230,7 @@ fun recipeGroupInformation(
id: Long? = null,
group: EmployeeGroup = employeeGroup(),
note: String? = null,
steps: Set<RecipeStep>? = setOf(),
steps: MutableSet<RecipeStep>? = mutableSetOf(),
op: RecipeGroupInformation.() -> Unit = {}
) = RecipeGroupInformation(id, group, note, steps).apply(op)

View File

@ -86,10 +86,15 @@ class RecipeServiceImpl(
with(recipe.groupInformationForGroup(it.groupId)) {
updatedGroupsInformation.add(
this?.apply {
this.steps = it.steps
if (this.steps != null) {
this.steps!!.clear()
this.steps!!.addAll(it.steps)
} else {
this.steps = it.steps.toMutableSet()
}
} ?: recipeGroupInformation(
group = groupService.getById(it.groupId),
steps = it.steps
steps = it.steps.toMutableSet()
)
)
}

View File

@ -1,4 +1,4 @@
spring.datasource.url=jdbc:mysql://172.66.1.1/updater
spring.datasource.url=jdbc:mysql://172.66.1.1/cre
spring.datasource.username=root
spring.datasource.password=pass
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver