diff --git a/app/src/main/java/gq/kirmanak/mealient/extensions/RemoteToLocalMappings.kt b/app/src/main/java/gq/kirmanak/mealient/extensions/RemoteToLocalMappings.kt index c457429..705ceb5 100644 --- a/app/src/main/java/gq/kirmanak/mealient/extensions/RemoteToLocalMappings.kt +++ b/app/src/main/java/gq/kirmanak/mealient/extensions/RemoteToLocalMappings.kt @@ -16,6 +16,7 @@ import gq.kirmanak.mealient.database.recipe.entity.RecipeSummaryEntity import gq.kirmanak.mealient.datasource.v0.models.* import gq.kirmanak.mealient.datasource.v1.models.* import gq.kirmanak.mealient.datastore.recipe.AddRecipeDraft +import java.util.* fun FullRecipeInfo.toRecipeEntity() = RecipeEntity( remoteId = remoteId, @@ -161,10 +162,12 @@ private fun AddRecipeSettingsInfo.toV1Settings() = AddRecipeSettingsV1( ) private fun AddRecipeIngredientInfo.toV1Ingredient() = AddRecipeIngredientV1( + id = UUID.randomUUID().toString(), note = note, ) private fun AddRecipeInstructionInfo.toV1Instruction() = AddRecipeInstructionV1( + id = UUID.randomUUID().toString(), text = text, ingredientReferences = emptyList(), ) \ No newline at end of file diff --git a/datasource/src/main/kotlin/gq/kirmanak/mealient/datasource/v0/models/AddRecipeRequestV0.kt b/datasource/src/main/kotlin/gq/kirmanak/mealient/datasource/v0/models/AddRecipeRequestV0.kt index 35f967e..fa6e6c7 100644 --- a/datasource/src/main/kotlin/gq/kirmanak/mealient/datasource/v0/models/AddRecipeRequestV0.kt +++ b/datasource/src/main/kotlin/gq/kirmanak/mealient/datasource/v0/models/AddRecipeRequestV0.kt @@ -5,26 +5,26 @@ import kotlinx.serialization.Serializable @Serializable data class AddRecipeRequestV0( - @SerialName("name") val name: String = "", - @SerialName("description") val description: String = "", - @SerialName("recipeYield") val recipeYield: String = "", - @SerialName("recipeIngredient") val recipeIngredient: List = emptyList(), - @SerialName("recipeInstructions") val recipeInstructions: List = emptyList(), - @SerialName("settings") val settings: AddRecipeSettingsV0 = AddRecipeSettingsV0(), + @SerialName("name") val name: String, + @SerialName("description") val description: String, + @SerialName("recipeYield") val recipeYield: String, + @SerialName("recipeIngredient") val recipeIngredient: List, + @SerialName("recipeInstructions") val recipeInstructions: List, + @SerialName("settings") val settings: AddRecipeSettingsV0, ) @Serializable data class AddRecipeIngredientV0( - @SerialName("note") val note: String = "", + @SerialName("note") val note: String, ) @Serializable data class AddRecipeInstructionV0( - @SerialName("text") val text: String = "", + @SerialName("text") val text: String, ) @Serializable data class AddRecipeSettingsV0( - @SerialName("disableComments") val disableComments: Boolean = false, - @SerialName("public") val public: Boolean = true, + @SerialName("disableComments") val disableComments: Boolean, + @SerialName("public") val public: Boolean, ) \ No newline at end of file diff --git a/datasource/src/main/kotlin/gq/kirmanak/mealient/datasource/v1/models/UpdateRecipeRequestV1.kt b/datasource/src/main/kotlin/gq/kirmanak/mealient/datasource/v1/models/UpdateRecipeRequestV1.kt index 019bd8c..3df266b 100644 --- a/datasource/src/main/kotlin/gq/kirmanak/mealient/datasource/v1/models/UpdateRecipeRequestV1.kt +++ b/datasource/src/main/kotlin/gq/kirmanak/mealient/datasource/v1/models/UpdateRecipeRequestV1.kt @@ -5,26 +5,28 @@ import kotlinx.serialization.Serializable @Serializable data class UpdateRecipeRequestV1( - @SerialName("description") val description: String = "", - @SerialName("recipeYield") val recipeYield: String = "", - @SerialName("recipeIngredient") val recipeIngredient: List = emptyList(), - @SerialName("recipeInstructions") val recipeInstructions: List = emptyList(), - @SerialName("settings") val settings: AddRecipeSettingsV1 = AddRecipeSettingsV1(), + @SerialName("description") val description: String, + @SerialName("recipeYield") val recipeYield: String, + @SerialName("recipeIngredient") val recipeIngredient: List, + @SerialName("recipeInstructions") val recipeInstructions: List, + @SerialName("settings") val settings: AddRecipeSettingsV1, ) @Serializable data class AddRecipeIngredientV1( - @SerialName("note") val note: String = "", + @SerialName("referenceId") val id: String, + @SerialName("note") val note: String, ) @Serializable data class AddRecipeInstructionV1( + @SerialName("id") val id: String, @SerialName("text") val text: String = "", - @SerialName("ingredientReferences") val ingredientReferences: List = emptyList(), + @SerialName("ingredientReferences") val ingredientReferences: List, ) @Serializable data class AddRecipeSettingsV1( - @SerialName("disableComments") val disableComments: Boolean = false, - @SerialName("public") val public: Boolean = true, + @SerialName("disableComments") val disableComments: Boolean, + @SerialName("public") val public: Boolean, ) \ No newline at end of file