L'échantillon d'une recette n'est plus obligatoire.

This commit is contained in:
FyloZ 2021-03-09 20:17:22 -05:00
parent 1f61ebdc5f
commit 06060eca89
1 changed files with 9 additions and 20 deletions

View File

@ -29,7 +29,7 @@ data class Recipe(
val description: String,
val sample: Int,
val sample: Int?,
@Column(name = "approbation_date")
val approbationDate: LocalDate?,
@ -106,9 +106,8 @@ open class RecipeSaveDto(
@field:NotBlank(message = RECIPE_DESCRIPTION_NULL_MESSAGE)
val description: String,
@field:NotNull(message = RECIPE_SAMPLE_NULL_MESSAGE)
@field:Min(value = 0, message = RECIPE_SAMPLE_TOO_SMALL_MESSAGE)
val sample: Int,
val sample: Int?,
val approbationDate: LocalDate?,
@ -145,24 +144,14 @@ open class RecipeUpdateDto(
val remark: String?,
val steps: List<RecipeStep>?
) : EntityDto<Recipe> {
override fun toEntity(): Recipe = recipe(
id,
name = name ?: "name",
description = description ?: "description",
sample = sample ?: -1,
approbationDate = approbationDate ?: LocalDate.MIN,
remark = remark ?: "remark",
steps = steps?.toMutableList() ?: mutableListOf()
)
}
) : EntityDto<Recipe>
// ==== DSL ====
fun recipe(
id: Long? = null,
name: String = "name",
description: String = "description",
sample: Int = -1,
sample: Int? = -1,
approbationDate: LocalDate? = LocalDate.MIN,
remark: String = "remark",
note: String = "",
@ -182,7 +171,7 @@ fun recipePublicDataDto(
fun recipeSaveDto(
name: String = "name",
description: String = "description",
sample: Int = -1,
sample: Int? = -1,
approbationDate: LocalDate? = LocalDate.MIN,
remark: String = "remark",
companyId: Long = 0L,
@ -191,11 +180,11 @@ fun recipeSaveDto(
fun recipeUpdateDto(
id: Long = 0L,
name: String = "name",
description: String = "description",
sample: Int = -1,
name: String? = "name",
description: String? = "description",
sample: Int? = -1,
approbationDate: LocalDate? = LocalDate.MIN,
remark: String? = "remark",
steps: List<RecipeStep> = listOf(),
steps: List<RecipeStep>? = listOf(),
op: RecipeUpdateDto.() -> Unit = {}
) = RecipeUpdateDto(id, name, description, sample, approbationDate, remark, steps).apply(op)