diff --git a/src/main/kotlin/dev/fyloz/trial/colorrecipesexplorer/model/Recipe.kt b/src/main/kotlin/dev/fyloz/trial/colorrecipesexplorer/model/Recipe.kt index c5a3712..9de7d65 100644 --- a/src/main/kotlin/dev/fyloz/trial/colorrecipesexplorer/model/Recipe.kt +++ b/src/main/kotlin/dev/fyloz/trial/colorrecipesexplorer/model/Recipe.kt @@ -121,10 +121,6 @@ open class RecipeUpdateDto( val remark: String? = "remark", - val note: String? = "note", - - val company: Company? = company(), - val steps: List? = listOf() ) : EntityDto { override fun toEntity(): Recipe = recipe( @@ -134,8 +130,6 @@ open class RecipeUpdateDto( sample = sample ?: -1, approbationDate = approbationDate ?: LocalDate.MIN, remark = remark ?: "remark", - note = note ?: "note", - company = company ?: company(), steps = steps ?: listOf() ) } @@ -172,8 +166,6 @@ fun recipeUpdateDto( sample: Int = -1, approbationDate: LocalDate? = LocalDate.MIN, remark: String? = "remark", - note: String? = "note", - company: Company = company(), steps: List = listOf(), op: RecipeUpdateDto.() -> Unit = {} -) = RecipeUpdateDto(id, name, description, sample, approbationDate, remark, note, company, steps).apply(op) +) = RecipeUpdateDto(id, name, description, sample, approbationDate, remark, steps).apply(op) diff --git a/src/main/kotlin/dev/fyloz/trial/colorrecipesexplorer/service/RecipeService.kt b/src/main/kotlin/dev/fyloz/trial/colorrecipesexplorer/service/RecipeService.kt index c51f4c7..b77660d 100644 --- a/src/main/kotlin/dev/fyloz/trial/colorrecipesexplorer/service/RecipeService.kt +++ b/src/main/kotlin/dev/fyloz/trial/colorrecipesexplorer/service/RecipeService.kt @@ -46,8 +46,9 @@ class RecipeServiceImpl(recipeRepository: RecipeRepository, val companyService: sample = if (sample != null && sample >= 0) sample else persistedRecipe.sample, approbationDate = approbationDate ?: persistedRecipe.approbationDate, remark = remark.or(persistedRecipe.remark), - note = note.or(persistedRecipe.note), - company = company ?: persistedRecipe.company, + note = persistedRecipe.note, + company = persistedRecipe.company, + mixes = persistedRecipe.mixes, steps = if (!steps.isNullOrEmpty()) steps else persistedRecipe.steps ) }) diff --git a/src/test/kotlin/dev/fyloz/trial/colorrecipesexplorer/service/RecipeServiceTest.kt b/src/test/kotlin/dev/fyloz/trial/colorrecipesexplorer/service/RecipeServiceTest.kt index f1c94ea..2ac5df3 100644 --- a/src/test/kotlin/dev/fyloz/trial/colorrecipesexplorer/service/RecipeServiceTest.kt +++ b/src/test/kotlin/dev/fyloz/trial/colorrecipesexplorer/service/RecipeServiceTest.kt @@ -22,7 +22,7 @@ class RecipeServiceTest : override val entity: Recipe = recipe(id = 0L, name = "recipe", company = company) override val anotherEntity: Recipe = recipe(id = 1L, name = "another recipe", company = company) override val entitySaveDto: RecipeSaveDto = spy(recipeSaveDto(name = entity.name, companyId = entity.company.id!!)) - override val entityUpdateDto: RecipeUpdateDto = spy(recipeUpdateDto(id = entity.id!!, name = entity.name, company = entity.company)) + override val entityUpdateDto: RecipeUpdateDto = spy(recipeUpdateDto(id = entity.id!!, name = entity.name)) @Nested inner class ExistsByCompany {