File tree Expand file tree Collapse file tree
app/src/main/java/de/lukasneugebauer/nextcloudcookbook/recipe/data/dto Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,10 +2,14 @@ package de.lukasneugebauer.nextcloudcookbook.recipe.data.dto
22
33import com.google.gson.annotations.SerializedName
44import de.lukasneugebauer.nextcloudcookbook.recipe.domain.model.RecipePreview
5+ import kotlin.jvm.Throws
56
67data class RecipePreviewDto (
8+ @Deprecated(message = " As of Cookbook v0.10.3, this field is deprecated." , replaceWith = ReplaceWith (expression = " id" ))
9+ @SerializedName(" recipe_id" )
10+ val recipeId : String? ,
711 @SerializedName(" id" )
8- val id : String ,
12+ val id : String? ,
913 @SerializedName(" name" )
1014 val name : String ,
1115 @SerializedName(" keywords" )
@@ -21,9 +25,10 @@ data class RecipePreviewDto(
2125 @SerializedName(" imagePlaceholderUrl" )
2226 val imagePlaceholderUrl : String? ,
2327) {
28+ @Throws(IllegalStateException ::class )
2429 fun toRecipePreview () =
2530 RecipePreview (
26- id = id ,
31+ id = if ( ! id.isNullOrBlank()) id else recipeId ? : throw IllegalStateException ( " Both 'id' and 'recipe_id' are null or blank " ) ,
2732 name = name,
2833 keywords = keywords?.split(" ," )?.toSet() ? : emptySet(),
2934 category = category ? : " " ,
You can’t perform that action at this time.
0 commit comments