La remarque est maintenant nullable dans RecipeSaveDto pour permettre de créer des recettes sans remarque plus facilement.

This commit is contained in:
FyloZ 2021-01-20 16:41:44 -05:00
parent f80064811a
commit b47b8d0df5
2 changed files with 11 additions and 11 deletions

View File

@ -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<RecipeStep> = listOf(),
op: RecipeUpdateDto.() -> Unit = {}

View File

@ -28,7 +28,7 @@ class RecipeServiceImpl(recipeRepository: RecipeRepository, val companyService:
description = description,
sample = sample,
approbationDate = approbationDate,
remark = remark,
remark = remark ?: "",
company = companyService.getById(companyId)
)
})