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 7b0354c..c5a3712 100644 --- a/src/main/kotlin/dev/fyloz/trial/colorrecipesexplorer/model/Recipe.kt +++ b/src/main/kotlin/dev/fyloz/trial/colorrecipesexplorer/model/Recipe.kt @@ -31,7 +31,7 @@ data class Recipe( val sample: Int, - val approbationDate: LocalDate, + val approbationDate: LocalDate?, /** A remark given by the creator of the recipe. */ val remark: String, @@ -55,7 +55,7 @@ data class Recipe( company: Company, description: String, sample: Int, - approbationDate: LocalDate, + approbationDate: LocalDate?, remark: String, note: String ) : this(id, name, description, sample, approbationDate, remark, note, company, listOf(), listOf()) @@ -87,9 +87,9 @@ open class RecipeSaveDto( @field:Min(value = 0, message = RECIPE_SAMPLE_TOO_SMALL_MESSAGE) val sample: Int, - val approbationDate: LocalDate, + val approbationDate: LocalDate?, - val remark: String, + val remark: String?, @field:Min(value = 0, message = RECIPE_COMPANY_NULL_MESSAGE) val companyId: Long = -1L, @@ -99,7 +99,7 @@ open class RecipeSaveDto( description = description, sample = sample, approbationDate = approbationDate, - remark = remark, + remark = remark ?: "", company = company(id = companyId) ) } @@ -146,7 +146,7 @@ fun recipe( name: String = "name", description: String = "description", sample: Int = -1, - approbationDate: LocalDate = LocalDate.MIN, + approbationDate: LocalDate? = LocalDate.MIN, remark: String = "remark", note: String = "", company: Company = company(), @@ -159,7 +159,7 @@ fun recipeSaveDto( name: String = "name", description: String = "description", sample: Int = -1, - approbationDate: LocalDate = LocalDate.MIN, + approbationDate: LocalDate? = LocalDate.MIN, remark: String = "remark", companyId: Long = 0L, op: RecipeSaveDto.() -> Unit = {} @@ -170,9 +170,9 @@ fun recipeUpdateDto( name: String = "name", description: String = "description", sample: Int = -1, - approbationDate: LocalDate = LocalDate.MIN, - remark: String = "remark", - note: String = "", + approbationDate: LocalDate? = LocalDate.MIN, + remark: String? = "remark", + note: String? = "note", company: Company = company(), steps: List = listOf(), op: RecipeUpdateDto.() -> Unit = {} 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 cf49079..c51f4c7 100644 --- a/src/main/kotlin/dev/fyloz/trial/colorrecipesexplorer/service/RecipeService.kt +++ b/src/main/kotlin/dev/fyloz/trial/colorrecipesexplorer/service/RecipeService.kt @@ -28,7 +28,7 @@ class RecipeServiceImpl(recipeRepository: RecipeRepository, val companyService: description = description, sample = sample, approbationDate = approbationDate, - remark = remark, + remark = remark ?: "", company = companyService.getById(companyId) ) })