Remove unused fields
This commit is contained in:
@@ -3,44 +3,21 @@ package gq.kirmanak.mealient.data.add
|
|||||||
data class AddRecipeInfo(
|
data class AddRecipeInfo(
|
||||||
val name: String = "",
|
val name: String = "",
|
||||||
val description: String = "",
|
val description: String = "",
|
||||||
val image: String = "",
|
|
||||||
val recipeYield: String = "",
|
val recipeYield: String = "",
|
||||||
val recipeIngredient: List<AddRecipeIngredientInfo> = emptyList(),
|
val recipeIngredient: List<AddRecipeIngredientInfo> = emptyList(),
|
||||||
val recipeInstructions: List<AddRecipeInstructionInfo> = emptyList(),
|
val recipeInstructions: List<AddRecipeInstructionInfo> = emptyList(),
|
||||||
val slug: String = "",
|
|
||||||
val filePath: String = "",
|
|
||||||
val tags: List<String> = emptyList(),
|
|
||||||
val categories: List<String> = emptyList(),
|
|
||||||
val notes: List<AddRecipeNoteInfo> = emptyList(),
|
|
||||||
val extras: Map<String, String> = emptyMap(),
|
|
||||||
val assets: List<String> = emptyList(),
|
|
||||||
val settings: AddRecipeSettingsInfo = AddRecipeSettingsInfo(),
|
val settings: AddRecipeSettingsInfo = AddRecipeSettingsInfo(),
|
||||||
)
|
)
|
||||||
|
|
||||||
data class AddRecipeSettingsInfo(
|
data class AddRecipeSettingsInfo(
|
||||||
val disableAmount: Boolean = true,
|
|
||||||
val disableComments: Boolean = false,
|
val disableComments: Boolean = false,
|
||||||
val landscapeView: Boolean = true,
|
|
||||||
val public: Boolean = true,
|
val public: Boolean = true,
|
||||||
val showAssets: Boolean = true,
|
|
||||||
val showNutrition: Boolean = true,
|
|
||||||
)
|
|
||||||
|
|
||||||
data class AddRecipeNoteInfo(
|
|
||||||
val title: String = "",
|
|
||||||
val text: String = "",
|
|
||||||
)
|
)
|
||||||
|
|
||||||
data class AddRecipeIngredientInfo(
|
data class AddRecipeIngredientInfo(
|
||||||
val disableAmount: Boolean = true,
|
|
||||||
val food: String? = null,
|
|
||||||
val note: String = "",
|
val note: String = "",
|
||||||
val quantity: Int = 1,
|
|
||||||
val title: String? = null,
|
|
||||||
val unit: String? = null,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
data class AddRecipeInstructionInfo(
|
data class AddRecipeInstructionInfo(
|
||||||
val title: String = "",
|
|
||||||
val text: String = "",
|
val text: String = "",
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,34 +1,17 @@
|
|||||||
package gq.kirmanak.mealient.data.recipes.network
|
package gq.kirmanak.mealient.data.recipes.network
|
||||||
|
|
||||||
import kotlinx.datetime.LocalDate
|
|
||||||
import kotlinx.datetime.LocalDateTime
|
|
||||||
|
|
||||||
data class FullRecipeInfo(
|
data class FullRecipeInfo(
|
||||||
val remoteId: String,
|
val remoteId: String,
|
||||||
val name: String,
|
val name: String,
|
||||||
val slug: String,
|
|
||||||
val image: String?,
|
|
||||||
val description: String,
|
|
||||||
val recipeCategories: List<String>,
|
|
||||||
val tags: List<String>,
|
|
||||||
val rating: Int?,
|
|
||||||
val dateAdded: LocalDate,
|
|
||||||
val dateUpdated: LocalDateTime,
|
|
||||||
val recipeYield: String,
|
val recipeYield: String,
|
||||||
val recipeIngredients: List<RecipeIngredientInfo>,
|
val recipeIngredients: List<RecipeIngredientInfo>,
|
||||||
val recipeInstructions: List<RecipeInstructionInfo>,
|
val recipeInstructions: List<RecipeInstructionInfo>,
|
||||||
)
|
)
|
||||||
|
|
||||||
data class RecipeIngredientInfo(
|
data class RecipeIngredientInfo(
|
||||||
val title: String,
|
|
||||||
val note: String,
|
val note: String,
|
||||||
val unit: String,
|
|
||||||
val food: String,
|
|
||||||
val disableAmount: Boolean,
|
|
||||||
val quantity: Double,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
data class RecipeInstructionInfo(
|
data class RecipeInstructionInfo(
|
||||||
val title: String,
|
|
||||||
val text: String,
|
val text: String,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package gq.kirmanak.mealient.extensions
|
package gq.kirmanak.mealient.extensions
|
||||||
|
|
||||||
import gq.kirmanak.mealient.data.add.*
|
import gq.kirmanak.mealient.data.add.AddRecipeInfo
|
||||||
|
import gq.kirmanak.mealient.data.add.AddRecipeIngredientInfo
|
||||||
|
import gq.kirmanak.mealient.data.add.AddRecipeInstructionInfo
|
||||||
|
import gq.kirmanak.mealient.data.add.AddRecipeSettingsInfo
|
||||||
import gq.kirmanak.mealient.data.baseurl.VersionInfo
|
import gq.kirmanak.mealient.data.baseurl.VersionInfo
|
||||||
import gq.kirmanak.mealient.data.recipes.network.FullRecipeInfo
|
import gq.kirmanak.mealient.data.recipes.network.FullRecipeInfo
|
||||||
import gq.kirmanak.mealient.data.recipes.network.RecipeIngredientInfo
|
import gq.kirmanak.mealient.data.recipes.network.RecipeIngredientInfo
|
||||||
@@ -21,17 +24,11 @@ fun FullRecipeInfo.toRecipeEntity() = RecipeEntity(
|
|||||||
|
|
||||||
fun RecipeIngredientInfo.toRecipeIngredientEntity(remoteId: String) = RecipeIngredientEntity(
|
fun RecipeIngredientInfo.toRecipeIngredientEntity(remoteId: String) = RecipeIngredientEntity(
|
||||||
recipeId = remoteId,
|
recipeId = remoteId,
|
||||||
title = title,
|
|
||||||
note = note,
|
note = note,
|
||||||
unit = unit,
|
|
||||||
food = food,
|
|
||||||
disableAmount = disableAmount,
|
|
||||||
quantity = quantity
|
|
||||||
)
|
)
|
||||||
|
|
||||||
fun RecipeInstructionInfo.toRecipeInstructionEntity(remoteId: String) = RecipeInstructionEntity(
|
fun RecipeInstructionInfo.toRecipeInstructionEntity(remoteId: String) = RecipeInstructionEntity(
|
||||||
recipeId = remoteId,
|
recipeId = remoteId,
|
||||||
title = title,
|
|
||||||
text = text
|
text = text
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -104,105 +101,54 @@ fun AddRecipeInfo.toDraft(): AddRecipeDraft = AddRecipeDraft(
|
|||||||
fun GetRecipeResponseV0.toFullRecipeInfo() = FullRecipeInfo(
|
fun GetRecipeResponseV0.toFullRecipeInfo() = FullRecipeInfo(
|
||||||
remoteId = remoteId.toString(),
|
remoteId = remoteId.toString(),
|
||||||
name = name,
|
name = name,
|
||||||
slug = slug,
|
|
||||||
image = image,
|
|
||||||
description = description,
|
|
||||||
recipeCategories = recipeCategories,
|
|
||||||
tags = tags,
|
|
||||||
rating = rating,
|
|
||||||
dateAdded = dateAdded,
|
|
||||||
dateUpdated = dateUpdated,
|
|
||||||
recipeYield = recipeYield,
|
recipeYield = recipeYield,
|
||||||
recipeIngredients = recipeIngredients.map { it.toRecipeIngredientInfo() },
|
recipeIngredients = recipeIngredients.map { it.toRecipeIngredientInfo() },
|
||||||
recipeInstructions = recipeInstructions.map { it.toRecipeInstructionInfo() }
|
recipeInstructions = recipeInstructions.map { it.toRecipeInstructionInfo() }
|
||||||
)
|
)
|
||||||
|
|
||||||
fun GetRecipeIngredientResponseV0.toRecipeIngredientInfo() = RecipeIngredientInfo(
|
fun GetRecipeIngredientResponseV0.toRecipeIngredientInfo() = RecipeIngredientInfo(
|
||||||
title = title,
|
|
||||||
note = note,
|
note = note,
|
||||||
unit = unit,
|
|
||||||
food = food,
|
|
||||||
disableAmount = disableAmount,
|
|
||||||
quantity = quantity
|
|
||||||
)
|
)
|
||||||
|
|
||||||
fun GetRecipeInstructionResponseV0.toRecipeInstructionInfo() = RecipeInstructionInfo(
|
fun GetRecipeInstructionResponseV0.toRecipeInstructionInfo() = RecipeInstructionInfo(
|
||||||
title = title,
|
|
||||||
text = text
|
text = text
|
||||||
)
|
)
|
||||||
|
|
||||||
fun GetRecipeResponseV1.toFullRecipeInfo() = FullRecipeInfo(
|
fun GetRecipeResponseV1.toFullRecipeInfo() = FullRecipeInfo(
|
||||||
remoteId = remoteId,
|
remoteId = remoteId,
|
||||||
name = name,
|
name = name,
|
||||||
slug = slug,
|
|
||||||
image = image,
|
|
||||||
description = description,
|
|
||||||
recipeCategories = recipeCategories,
|
|
||||||
tags = tags,
|
|
||||||
rating = rating,
|
|
||||||
dateAdded = dateAdded,
|
|
||||||
dateUpdated = dateUpdated,
|
|
||||||
recipeYield = recipeYield,
|
recipeYield = recipeYield,
|
||||||
recipeIngredients = recipeIngredients.map { it.toRecipeIngredientInfo() },
|
recipeIngredients = recipeIngredients.map { it.toRecipeIngredientInfo() },
|
||||||
recipeInstructions = recipeInstructions.map { it.toRecipeInstructionInfo() }
|
recipeInstructions = recipeInstructions.map { it.toRecipeInstructionInfo() }
|
||||||
)
|
)
|
||||||
|
|
||||||
fun GetRecipeIngredientResponseV1.toRecipeIngredientInfo() = RecipeIngredientInfo(
|
fun GetRecipeIngredientResponseV1.toRecipeIngredientInfo() = RecipeIngredientInfo(
|
||||||
title = title,
|
|
||||||
note = note,
|
note = note,
|
||||||
unit = unit,
|
|
||||||
food = food,
|
|
||||||
disableAmount = disableAmount,
|
|
||||||
quantity = quantity
|
|
||||||
)
|
)
|
||||||
|
|
||||||
fun GetRecipeInstructionResponseV1.toRecipeInstructionInfo() = RecipeInstructionInfo(
|
fun GetRecipeInstructionResponseV1.toRecipeInstructionInfo() = RecipeInstructionInfo(
|
||||||
title = title,
|
|
||||||
text = text
|
text = text
|
||||||
)
|
)
|
||||||
|
|
||||||
fun AddRecipeInfo.toV0Request() = AddRecipeRequestV0(
|
fun AddRecipeInfo.toV0Request() = AddRecipeRequestV0(
|
||||||
name = name,
|
name = name,
|
||||||
description = description,
|
description = description,
|
||||||
image = image,
|
|
||||||
recipeYield = recipeYield,
|
recipeYield = recipeYield,
|
||||||
recipeIngredient = recipeIngredient.map { it.toV0Ingredient() },
|
recipeIngredient = recipeIngredient.map { it.toV0Ingredient() },
|
||||||
recipeInstructions = recipeInstructions.map { it.toV0Instruction() },
|
recipeInstructions = recipeInstructions.map { it.toV0Instruction() },
|
||||||
slug = slug,
|
|
||||||
filePath = filePath,
|
|
||||||
tags = tags,
|
|
||||||
categories = categories,
|
|
||||||
notes = notes.map { it.toV0Note() },
|
|
||||||
extras = extras,
|
|
||||||
assets = assets,
|
|
||||||
settings = settings.toV0Settings(),
|
settings = settings.toV0Settings(),
|
||||||
)
|
)
|
||||||
|
|
||||||
private fun AddRecipeSettingsInfo.toV0Settings() = AddRecipeSettingsV0(
|
private fun AddRecipeSettingsInfo.toV0Settings() = AddRecipeSettingsV0(
|
||||||
disableAmount = disableAmount,
|
|
||||||
disableComments = disableComments,
|
disableComments = disableComments,
|
||||||
landscapeView = landscapeView,
|
|
||||||
public = public,
|
public = public,
|
||||||
showAssets = showAssets,
|
|
||||||
showNutrition = showNutrition,
|
|
||||||
)
|
|
||||||
|
|
||||||
private fun AddRecipeNoteInfo.toV0Note() = AddRecipeNoteV0(
|
|
||||||
title = title,
|
|
||||||
text = text,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
private fun AddRecipeIngredientInfo.toV0Ingredient() = AddRecipeIngredientV0(
|
private fun AddRecipeIngredientInfo.toV0Ingredient() = AddRecipeIngredientV0(
|
||||||
disableAmount = disableAmount,
|
|
||||||
food = food,
|
|
||||||
note = note,
|
note = note,
|
||||||
quantity = quantity,
|
|
||||||
title = title,
|
|
||||||
unit = unit
|
|
||||||
)
|
)
|
||||||
|
|
||||||
private fun AddRecipeInstructionInfo.toV0Instruction() = AddRecipeInstructionV0(
|
private fun AddRecipeInstructionInfo.toV0Instruction() = AddRecipeInstructionV0(
|
||||||
title = title,
|
|
||||||
text = text,
|
text = text,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -213,44 +159,22 @@ fun AddRecipeInfo.toV1CreateRequest() = CreateRecipeRequestV1(
|
|||||||
|
|
||||||
fun AddRecipeInfo.toV1UpdateRequest() = UpdateRecipeRequestV1(
|
fun AddRecipeInfo.toV1UpdateRequest() = UpdateRecipeRequestV1(
|
||||||
description = description,
|
description = description,
|
||||||
image = image,
|
|
||||||
recipeYield = recipeYield,
|
recipeYield = recipeYield,
|
||||||
recipeIngredient = recipeIngredient.map { it.toV1Ingredient() },
|
recipeIngredient = recipeIngredient.map { it.toV1Ingredient() },
|
||||||
recipeInstructions = recipeInstructions.map { it.toV1Instruction() },
|
recipeInstructions = recipeInstructions.map { it.toV1Instruction() },
|
||||||
filePath = filePath,
|
|
||||||
tags = tags,
|
|
||||||
categories = categories,
|
|
||||||
notes = notes.map { it.toV1Note() },
|
|
||||||
extras = extras,
|
|
||||||
assets = assets,
|
|
||||||
settings = settings.toV1Settings(),
|
settings = settings.toV1Settings(),
|
||||||
)
|
)
|
||||||
|
|
||||||
private fun AddRecipeSettingsInfo.toV1Settings() = AddRecipeSettingsV1(
|
private fun AddRecipeSettingsInfo.toV1Settings() = AddRecipeSettingsV1(
|
||||||
disableAmount = disableAmount,
|
|
||||||
disableComments = disableComments,
|
disableComments = disableComments,
|
||||||
landscapeView = landscapeView,
|
|
||||||
public = public,
|
public = public,
|
||||||
showAssets = showAssets,
|
|
||||||
showNutrition = showNutrition,
|
|
||||||
)
|
|
||||||
|
|
||||||
private fun AddRecipeNoteInfo.toV1Note() = AddRecipeNoteV1(
|
|
||||||
title = title,
|
|
||||||
text = text,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
private fun AddRecipeIngredientInfo.toV1Ingredient() = AddRecipeIngredientV1(
|
private fun AddRecipeIngredientInfo.toV1Ingredient() = AddRecipeIngredientV1(
|
||||||
disableAmount = disableAmount,
|
|
||||||
food = food,
|
|
||||||
note = note,
|
note = note,
|
||||||
quantity = quantity,
|
|
||||||
title = title,
|
|
||||||
unit = unit
|
|
||||||
)
|
)
|
||||||
|
|
||||||
private fun AddRecipeInstructionInfo.toV1Instruction() = AddRecipeInstructionV1(
|
private fun AddRecipeInstructionInfo.toV1Instruction() = AddRecipeInstructionV1(
|
||||||
title = title,
|
|
||||||
text = text,
|
text = text,
|
||||||
ingredientReferences = emptyList(),
|
ingredientReferences = emptyList(),
|
||||||
)
|
)
|
||||||
@@ -64,58 +64,32 @@ object RecipeImplTestData {
|
|||||||
)
|
)
|
||||||
|
|
||||||
private val SUGAR_INGREDIENT = RecipeIngredientInfo(
|
private val SUGAR_INGREDIENT = RecipeIngredientInfo(
|
||||||
title = "Sugar",
|
|
||||||
note = "2 oz of white sugar",
|
note = "2 oz of white sugar",
|
||||||
unit = "",
|
|
||||||
food = "",
|
|
||||||
disableAmount = true,
|
|
||||||
quantity = 1.0
|
|
||||||
)
|
)
|
||||||
|
|
||||||
val BREAD_INGREDIENT = RecipeIngredientInfo(
|
val BREAD_INGREDIENT = RecipeIngredientInfo(
|
||||||
title = "Bread",
|
|
||||||
note = "2 oz of white bread",
|
note = "2 oz of white bread",
|
||||||
unit = "",
|
|
||||||
food = "",
|
|
||||||
disableAmount = false,
|
|
||||||
quantity = 2.0
|
|
||||||
)
|
)
|
||||||
|
|
||||||
private val MILK_INGREDIENT = RecipeIngredientInfo(
|
private val MILK_INGREDIENT = RecipeIngredientInfo(
|
||||||
title = "Milk",
|
|
||||||
note = "2 oz of white milk",
|
note = "2 oz of white milk",
|
||||||
unit = "",
|
|
||||||
food = "",
|
|
||||||
disableAmount = true,
|
|
||||||
quantity = 3.0
|
|
||||||
)
|
)
|
||||||
|
|
||||||
val MIX_INSTRUCTION = RecipeInstructionInfo(
|
val MIX_INSTRUCTION = RecipeInstructionInfo(
|
||||||
title = "Mix",
|
|
||||||
text = "Mix the ingredients"
|
text = "Mix the ingredients"
|
||||||
)
|
)
|
||||||
|
|
||||||
private val BAKE_INSTRUCTION = RecipeInstructionInfo(
|
private val BAKE_INSTRUCTION = RecipeInstructionInfo(
|
||||||
title = "Bake",
|
|
||||||
text = "Bake the ingredients"
|
text = "Bake the ingredients"
|
||||||
)
|
)
|
||||||
|
|
||||||
private val BOIL_INSTRUCTION = RecipeInstructionInfo(
|
private val BOIL_INSTRUCTION = RecipeInstructionInfo(
|
||||||
title = "Boil",
|
|
||||||
text = "Boil the ingredients"
|
text = "Boil the ingredients"
|
||||||
)
|
)
|
||||||
|
|
||||||
val GET_CAKE_RESPONSE = FullRecipeInfo(
|
val GET_CAKE_RESPONSE = FullRecipeInfo(
|
||||||
remoteId = "1",
|
remoteId = "1",
|
||||||
name = "Cake",
|
name = "Cake",
|
||||||
slug = "cake",
|
|
||||||
image = "86",
|
|
||||||
description = "A tasty cake",
|
|
||||||
recipeCategories = listOf("dessert", "tasty"),
|
|
||||||
tags = listOf("gluten", "allergic"),
|
|
||||||
rating = 4,
|
|
||||||
dateAdded = LocalDate.parse("2021-11-13"),
|
|
||||||
dateUpdated = LocalDateTime.parse("2021-11-13T15:30:13"),
|
|
||||||
recipeYield = "4 servings",
|
recipeYield = "4 servings",
|
||||||
recipeIngredients = listOf(SUGAR_INGREDIENT, BREAD_INGREDIENT),
|
recipeIngredients = listOf(SUGAR_INGREDIENT, BREAD_INGREDIENT),
|
||||||
recipeInstructions = listOf(MIX_INSTRUCTION, BAKE_INSTRUCTION)
|
recipeInstructions = listOf(MIX_INSTRUCTION, BAKE_INSTRUCTION)
|
||||||
@@ -124,14 +98,6 @@ object RecipeImplTestData {
|
|||||||
val GET_PORRIDGE_RESPONSE = FullRecipeInfo(
|
val GET_PORRIDGE_RESPONSE = FullRecipeInfo(
|
||||||
remoteId = "2",
|
remoteId = "2",
|
||||||
name = "Porridge",
|
name = "Porridge",
|
||||||
slug = "porridge",
|
|
||||||
image = "89",
|
|
||||||
description = "A tasty porridge",
|
|
||||||
recipeCategories = listOf("porridge", "tasty"),
|
|
||||||
tags = listOf("gluten", "milk"),
|
|
||||||
rating = 5,
|
|
||||||
dateAdded = LocalDate.parse("2021-11-12"),
|
|
||||||
dateUpdated = LocalDateTime.parse("2021-10-13T17:35:23"),
|
|
||||||
recipeYield = "3 servings",
|
recipeYield = "3 servings",
|
||||||
recipeIngredients = listOf(SUGAR_INGREDIENT, MILK_INGREDIENT),
|
recipeIngredients = listOf(SUGAR_INGREDIENT, MILK_INGREDIENT),
|
||||||
recipeInstructions = listOf(MIX_INSTRUCTION, BOIL_INSTRUCTION)
|
recipeInstructions = listOf(MIX_INSTRUCTION, BOIL_INSTRUCTION)
|
||||||
@@ -140,14 +106,12 @@ object RecipeImplTestData {
|
|||||||
val MIX_CAKE_RECIPE_INSTRUCTION_ENTITY = RecipeInstructionEntity(
|
val MIX_CAKE_RECIPE_INSTRUCTION_ENTITY = RecipeInstructionEntity(
|
||||||
localId = 1,
|
localId = 1,
|
||||||
recipeId = "1",
|
recipeId = "1",
|
||||||
title = "Mix",
|
|
||||||
text = "Mix the ingredients",
|
text = "Mix the ingredients",
|
||||||
)
|
)
|
||||||
|
|
||||||
private val BAKE_CAKE_RECIPE_INSTRUCTION_ENTITY = RecipeInstructionEntity(
|
private val BAKE_CAKE_RECIPE_INSTRUCTION_ENTITY = RecipeInstructionEntity(
|
||||||
localId = 2,
|
localId = 2,
|
||||||
recipeId = "1",
|
recipeId = "1",
|
||||||
title = "Bake",
|
|
||||||
text = "Bake the ingredients",
|
text = "Bake the ingredients",
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -159,23 +123,13 @@ object RecipeImplTestData {
|
|||||||
private val CAKE_SUGAR_RECIPE_INGREDIENT_ENTITY = RecipeIngredientEntity(
|
private val CAKE_SUGAR_RECIPE_INGREDIENT_ENTITY = RecipeIngredientEntity(
|
||||||
localId = 1,
|
localId = 1,
|
||||||
recipeId = "1",
|
recipeId = "1",
|
||||||
title = "Sugar",
|
|
||||||
note = "2 oz of white sugar",
|
note = "2 oz of white sugar",
|
||||||
unit = "",
|
|
||||||
food = "",
|
|
||||||
disableAmount = true,
|
|
||||||
quantity = 1.0
|
|
||||||
)
|
)
|
||||||
|
|
||||||
val CAKE_BREAD_RECIPE_INGREDIENT_ENTITY = RecipeIngredientEntity(
|
val CAKE_BREAD_RECIPE_INGREDIENT_ENTITY = RecipeIngredientEntity(
|
||||||
localId = 2,
|
localId = 2,
|
||||||
recipeId = "1",
|
recipeId = "1",
|
||||||
title = "Bread",
|
|
||||||
note = "2 oz of white bread",
|
note = "2 oz of white bread",
|
||||||
unit = "",
|
|
||||||
food = "",
|
|
||||||
disableAmount = false,
|
|
||||||
quantity = 2.0
|
|
||||||
)
|
)
|
||||||
|
|
||||||
val FULL_CAKE_INFO_ENTITY = FullRecipeEntity(
|
val FULL_CAKE_INFO_ENTITY = FullRecipeEntity(
|
||||||
@@ -199,36 +153,24 @@ object RecipeImplTestData {
|
|||||||
private val PORRIDGE_MILK_RECIPE_INGREDIENT_ENTITY = RecipeIngredientEntity(
|
private val PORRIDGE_MILK_RECIPE_INGREDIENT_ENTITY = RecipeIngredientEntity(
|
||||||
localId = 4,
|
localId = 4,
|
||||||
recipeId = "2",
|
recipeId = "2",
|
||||||
title = "Milk",
|
|
||||||
note = "2 oz of white milk",
|
note = "2 oz of white milk",
|
||||||
unit = "",
|
|
||||||
food = "",
|
|
||||||
disableAmount = true,
|
|
||||||
quantity = 3.0
|
|
||||||
)
|
)
|
||||||
|
|
||||||
private val PORRIDGE_SUGAR_RECIPE_INGREDIENT_ENTITY = RecipeIngredientEntity(
|
private val PORRIDGE_SUGAR_RECIPE_INGREDIENT_ENTITY = RecipeIngredientEntity(
|
||||||
localId = 3,
|
localId = 3,
|
||||||
recipeId = "2",
|
recipeId = "2",
|
||||||
title = "Sugar",
|
|
||||||
note = "2 oz of white sugar",
|
note = "2 oz of white sugar",
|
||||||
unit = "",
|
|
||||||
food = "",
|
|
||||||
disableAmount = true,
|
|
||||||
quantity = 1.0
|
|
||||||
)
|
)
|
||||||
|
|
||||||
private val PORRIDGE_MIX_RECIPE_INSTRUCTION_ENTITY = RecipeInstructionEntity(
|
private val PORRIDGE_MIX_RECIPE_INSTRUCTION_ENTITY = RecipeInstructionEntity(
|
||||||
localId = 3,
|
localId = 3,
|
||||||
recipeId = "2",
|
recipeId = "2",
|
||||||
title = "Mix",
|
|
||||||
text = "Mix the ingredients"
|
text = "Mix the ingredients"
|
||||||
)
|
)
|
||||||
|
|
||||||
private val PORRIDGE_BOIL_RECIPE_INSTRUCTION_ENTITY = RecipeInstructionEntity(
|
private val PORRIDGE_BOIL_RECIPE_INSTRUCTION_ENTITY = RecipeInstructionEntity(
|
||||||
localId = 4,
|
localId = 4,
|
||||||
recipeId = "2",
|
recipeId = "2",
|
||||||
title = "Boil",
|
|
||||||
text = "Boil the ingredients"
|
text = "Boil the ingredients"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
374
database/schemas/gq.kirmanak.mealient.database.AppDb/5.json
Normal file
374
database/schemas/gq.kirmanak.mealient.database.AppDb/5.json
Normal file
@@ -0,0 +1,374 @@
|
|||||||
|
{
|
||||||
|
"formatVersion": 1,
|
||||||
|
"database": {
|
||||||
|
"version": 5,
|
||||||
|
"identityHash": "e75a1e16503fdf60c62b7f9d17ec0bc6",
|
||||||
|
"entities": [
|
||||||
|
{
|
||||||
|
"tableName": "categories",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`local_id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `name` TEXT NOT NULL)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "localId",
|
||||||
|
"columnName": "local_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "name",
|
||||||
|
"columnName": "name",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"columnNames": [
|
||||||
|
"local_id"
|
||||||
|
],
|
||||||
|
"autoGenerate": true
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_categories_name",
|
||||||
|
"unique": true,
|
||||||
|
"columnNames": [
|
||||||
|
"name"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_categories_name` ON `${TABLE_NAME}` (`name`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "category_recipe",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`category_id` INTEGER NOT NULL, `recipe_id` TEXT NOT NULL, PRIMARY KEY(`category_id`, `recipe_id`), FOREIGN KEY(`category_id`) REFERENCES `categories`(`local_id`) ON UPDATE CASCADE ON DELETE CASCADE , FOREIGN KEY(`recipe_id`) REFERENCES `recipe_summaries`(`remote_id`) ON UPDATE CASCADE ON DELETE CASCADE )",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "categoryId",
|
||||||
|
"columnName": "category_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "recipeId",
|
||||||
|
"columnName": "recipe_id",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"columnNames": [
|
||||||
|
"category_id",
|
||||||
|
"recipe_id"
|
||||||
|
],
|
||||||
|
"autoGenerate": false
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_category_recipe_category_id_recipe_id",
|
||||||
|
"unique": true,
|
||||||
|
"columnNames": [
|
||||||
|
"category_id",
|
||||||
|
"recipe_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_category_recipe_category_id_recipe_id` ON `${TABLE_NAME}` (`category_id`, `recipe_id`)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "index_category_recipe_recipe_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"recipe_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_category_recipe_recipe_id` ON `${TABLE_NAME}` (`recipe_id`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": [
|
||||||
|
{
|
||||||
|
"table": "categories",
|
||||||
|
"onDelete": "CASCADE",
|
||||||
|
"onUpdate": "CASCADE",
|
||||||
|
"columns": [
|
||||||
|
"category_id"
|
||||||
|
],
|
||||||
|
"referencedColumns": [
|
||||||
|
"local_id"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"table": "recipe_summaries",
|
||||||
|
"onDelete": "CASCADE",
|
||||||
|
"onUpdate": "CASCADE",
|
||||||
|
"columns": [
|
||||||
|
"recipe_id"
|
||||||
|
],
|
||||||
|
"referencedColumns": [
|
||||||
|
"remote_id"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "tags",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`local_id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `name` TEXT NOT NULL)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "localId",
|
||||||
|
"columnName": "local_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "name",
|
||||||
|
"columnName": "name",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"columnNames": [
|
||||||
|
"local_id"
|
||||||
|
],
|
||||||
|
"autoGenerate": true
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_tags_name",
|
||||||
|
"unique": true,
|
||||||
|
"columnNames": [
|
||||||
|
"name"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_tags_name` ON `${TABLE_NAME}` (`name`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "tag_recipe",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`tag_id` INTEGER NOT NULL, `recipe_id` TEXT NOT NULL, PRIMARY KEY(`tag_id`, `recipe_id`), FOREIGN KEY(`tag_id`) REFERENCES `tags`(`local_id`) ON UPDATE CASCADE ON DELETE CASCADE , FOREIGN KEY(`recipe_id`) REFERENCES `recipe_summaries`(`remote_id`) ON UPDATE CASCADE ON DELETE CASCADE )",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "tagId",
|
||||||
|
"columnName": "tag_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "recipeId",
|
||||||
|
"columnName": "recipe_id",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"columnNames": [
|
||||||
|
"tag_id",
|
||||||
|
"recipe_id"
|
||||||
|
],
|
||||||
|
"autoGenerate": false
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_tag_recipe_recipe_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"recipe_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_tag_recipe_recipe_id` ON `${TABLE_NAME}` (`recipe_id`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": [
|
||||||
|
{
|
||||||
|
"table": "tags",
|
||||||
|
"onDelete": "CASCADE",
|
||||||
|
"onUpdate": "CASCADE",
|
||||||
|
"columns": [
|
||||||
|
"tag_id"
|
||||||
|
],
|
||||||
|
"referencedColumns": [
|
||||||
|
"local_id"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"table": "recipe_summaries",
|
||||||
|
"onDelete": "CASCADE",
|
||||||
|
"onUpdate": "CASCADE",
|
||||||
|
"columns": [
|
||||||
|
"recipe_id"
|
||||||
|
],
|
||||||
|
"referencedColumns": [
|
||||||
|
"remote_id"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "recipe_summaries",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`remote_id` TEXT NOT NULL, `name` TEXT NOT NULL, `slug` TEXT NOT NULL, `image` TEXT, `description` TEXT NOT NULL, `rating` INTEGER, `date_added` INTEGER NOT NULL, `date_updated` INTEGER NOT NULL, `image_id` TEXT, PRIMARY KEY(`remote_id`))",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "remoteId",
|
||||||
|
"columnName": "remote_id",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "name",
|
||||||
|
"columnName": "name",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "slug",
|
||||||
|
"columnName": "slug",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "image",
|
||||||
|
"columnName": "image",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "description",
|
||||||
|
"columnName": "description",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "rating",
|
||||||
|
"columnName": "rating",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "dateAdded",
|
||||||
|
"columnName": "date_added",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "dateUpdated",
|
||||||
|
"columnName": "date_updated",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "imageId",
|
||||||
|
"columnName": "image_id",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"columnNames": [
|
||||||
|
"remote_id"
|
||||||
|
],
|
||||||
|
"autoGenerate": false
|
||||||
|
},
|
||||||
|
"indices": [],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "recipe",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`remote_id` TEXT NOT NULL, `recipe_yield` TEXT NOT NULL, PRIMARY KEY(`remote_id`))",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "remoteId",
|
||||||
|
"columnName": "remote_id",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "recipeYield",
|
||||||
|
"columnName": "recipe_yield",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"columnNames": [
|
||||||
|
"remote_id"
|
||||||
|
],
|
||||||
|
"autoGenerate": false
|
||||||
|
},
|
||||||
|
"indices": [],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "recipe_ingredient",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`local_id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `recipe_id` TEXT NOT NULL, `note` TEXT NOT NULL)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "localId",
|
||||||
|
"columnName": "local_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "recipeId",
|
||||||
|
"columnName": "recipe_id",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "note",
|
||||||
|
"columnName": "note",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"columnNames": [
|
||||||
|
"local_id"
|
||||||
|
],
|
||||||
|
"autoGenerate": true
|
||||||
|
},
|
||||||
|
"indices": [],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "recipe_instruction",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`local_id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `recipe_id` TEXT NOT NULL, `text` TEXT NOT NULL)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "localId",
|
||||||
|
"columnName": "local_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "recipeId",
|
||||||
|
"columnName": "recipe_id",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "text",
|
||||||
|
"columnName": "text",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"columnNames": [
|
||||||
|
"local_id"
|
||||||
|
],
|
||||||
|
"autoGenerate": true
|
||||||
|
},
|
||||||
|
"indices": [],
|
||||||
|
"foreignKeys": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"views": [],
|
||||||
|
"setupQueries": [
|
||||||
|
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
|
||||||
|
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'e75a1e16503fdf60c62b7f9d17ec0bc6')"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,14 +1,12 @@
|
|||||||
package gq.kirmanak.mealient.database
|
package gq.kirmanak.mealient.database
|
||||||
|
|
||||||
import androidx.room.AutoMigration
|
import androidx.room.*
|
||||||
import androidx.room.Database
|
import androidx.room.migration.AutoMigrationSpec
|
||||||
import androidx.room.RoomDatabase
|
|
||||||
import androidx.room.TypeConverters
|
|
||||||
import gq.kirmanak.mealient.database.recipe.RecipeDao
|
import gq.kirmanak.mealient.database.recipe.RecipeDao
|
||||||
import gq.kirmanak.mealient.database.recipe.entity.*
|
import gq.kirmanak.mealient.database.recipe.entity.*
|
||||||
|
|
||||||
@Database(
|
@Database(
|
||||||
version = 4,
|
version = 5,
|
||||||
entities = [
|
entities = [
|
||||||
CategoryEntity::class,
|
CategoryEntity::class,
|
||||||
CategoryRecipeEntity::class,
|
CategoryRecipeEntity::class,
|
||||||
@@ -23,9 +21,18 @@ import gq.kirmanak.mealient.database.recipe.entity.*
|
|||||||
autoMigrations = [
|
autoMigrations = [
|
||||||
AutoMigration(from = 1, to = 2),
|
AutoMigration(from = 1, to = 2),
|
||||||
AutoMigration(from = 3, to = 4),
|
AutoMigration(from = 3, to = 4),
|
||||||
|
AutoMigration(from = 4, to = 5, spec = AppDb.From4To5Migration::class),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@TypeConverters(RoomTypeConverters::class)
|
@TypeConverters(RoomTypeConverters::class)
|
||||||
abstract class AppDb : RoomDatabase() {
|
abstract class AppDb : RoomDatabase() {
|
||||||
abstract fun recipeDao(): RecipeDao
|
abstract fun recipeDao(): RecipeDao
|
||||||
|
|
||||||
|
@DeleteColumn(tableName = "recipe_instruction", columnName = "title")
|
||||||
|
@DeleteColumn(tableName = "recipe_ingredient", columnName = "title")
|
||||||
|
@DeleteColumn(tableName = "recipe_ingredient", columnName = "unit")
|
||||||
|
@DeleteColumn(tableName = "recipe_ingredient", columnName = "food")
|
||||||
|
@DeleteColumn(tableName = "recipe_ingredient", columnName = "disable_amount")
|
||||||
|
@DeleteColumn(tableName = "recipe_ingredient", columnName = "quantity")
|
||||||
|
class From4To5Migration : AutoMigrationSpec
|
||||||
}
|
}
|
||||||
@@ -8,10 +8,5 @@ import androidx.room.PrimaryKey
|
|||||||
data class RecipeIngredientEntity(
|
data class RecipeIngredientEntity(
|
||||||
@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "local_id") val localId: Long = 0,
|
@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "local_id") val localId: Long = 0,
|
||||||
@ColumnInfo(name = "recipe_id") val recipeId: String,
|
@ColumnInfo(name = "recipe_id") val recipeId: String,
|
||||||
@ColumnInfo(name = "title") val title: String,
|
|
||||||
@ColumnInfo(name = "note") val note: String,
|
@ColumnInfo(name = "note") val note: String,
|
||||||
@ColumnInfo(name = "unit") val unit: String,
|
|
||||||
@ColumnInfo(name = "food") val food: String,
|
|
||||||
@ColumnInfo(name = "disable_amount") val disableAmount: Boolean,
|
|
||||||
@ColumnInfo(name = "quantity") val quantity: Double,
|
|
||||||
)
|
)
|
||||||
@@ -8,6 +8,5 @@ import androidx.room.PrimaryKey
|
|||||||
data class RecipeInstructionEntity(
|
data class RecipeInstructionEntity(
|
||||||
@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "local_id") val localId: Long = 0,
|
@PrimaryKey(autoGenerate = true) @ColumnInfo(name = "local_id") val localId: Long = 0,
|
||||||
@ColumnInfo(name = "recipe_id") val recipeId: String,
|
@ColumnInfo(name = "recipe_id") val recipeId: String,
|
||||||
@ColumnInfo(name = "title") val title: String,
|
|
||||||
@ColumnInfo(name = "text") val text: String,
|
@ColumnInfo(name = "text") val text: String,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -7,48 +7,24 @@ import kotlinx.serialization.Serializable
|
|||||||
data class AddRecipeRequestV0(
|
data class AddRecipeRequestV0(
|
||||||
@SerialName("name") val name: String = "",
|
@SerialName("name") val name: String = "",
|
||||||
@SerialName("description") val description: String = "",
|
@SerialName("description") val description: String = "",
|
||||||
@SerialName("image") val image: String = "",
|
|
||||||
@SerialName("recipeYield") val recipeYield: String = "",
|
@SerialName("recipeYield") val recipeYield: String = "",
|
||||||
@SerialName("recipeIngredient") val recipeIngredient: List<AddRecipeIngredientV0> = emptyList(),
|
@SerialName("recipeIngredient") val recipeIngredient: List<AddRecipeIngredientV0> = emptyList(),
|
||||||
@SerialName("recipeInstructions") val recipeInstructions: List<AddRecipeInstructionV0> = emptyList(),
|
@SerialName("recipeInstructions") val recipeInstructions: List<AddRecipeInstructionV0> = emptyList(),
|
||||||
@SerialName("slug") val slug: String = "",
|
|
||||||
@SerialName("filePath") val filePath: String = "",
|
|
||||||
@SerialName("tags") val tags: List<String> = emptyList(),
|
|
||||||
@SerialName("categories") val categories: List<String> = emptyList(),
|
|
||||||
@SerialName("notes") val notes: List<AddRecipeNoteV0> = emptyList(),
|
|
||||||
@SerialName("extras") val extras: Map<String, String> = emptyMap(),
|
|
||||||
@SerialName("assets") val assets: List<String> = emptyList(),
|
|
||||||
@SerialName("settings") val settings: AddRecipeSettingsV0 = AddRecipeSettingsV0(),
|
@SerialName("settings") val settings: AddRecipeSettingsV0 = AddRecipeSettingsV0(),
|
||||||
)
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class AddRecipeIngredientV0(
|
data class AddRecipeIngredientV0(
|
||||||
@SerialName("disableAmount") val disableAmount: Boolean = true,
|
|
||||||
@SerialName("food") val food: String? = null,
|
|
||||||
@SerialName("note") val note: String = "",
|
@SerialName("note") val note: String = "",
|
||||||
@SerialName("quantity") val quantity: Int = 1,
|
|
||||||
@SerialName("title") val title: String? = null,
|
|
||||||
@SerialName("unit") val unit: String? = null,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class AddRecipeInstructionV0(
|
data class AddRecipeInstructionV0(
|
||||||
@SerialName("title") val title: String = "",
|
|
||||||
@SerialName("text") val text: String = "",
|
|
||||||
)
|
|
||||||
|
|
||||||
@Serializable
|
|
||||||
data class AddRecipeNoteV0(
|
|
||||||
@SerialName("title") val title: String = "",
|
|
||||||
@SerialName("text") val text: String = "",
|
@SerialName("text") val text: String = "",
|
||||||
)
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class AddRecipeSettingsV0(
|
data class AddRecipeSettingsV0(
|
||||||
@SerialName("disableAmount") val disableAmount: Boolean = true,
|
|
||||||
@SerialName("disableComments") val disableComments: Boolean = false,
|
@SerialName("disableComments") val disableComments: Boolean = false,
|
||||||
@SerialName("landscapeView") val landscapeView: Boolean = true,
|
|
||||||
@SerialName("public") val public: Boolean = true,
|
@SerialName("public") val public: Boolean = true,
|
||||||
@SerialName("showAssets") val showAssets: Boolean = true,
|
|
||||||
@SerialName("showNutrition") val showNutrition: Boolean = true,
|
|
||||||
)
|
)
|
||||||
@@ -1,7 +1,5 @@
|
|||||||
package gq.kirmanak.mealient.datasource.v0.models
|
package gq.kirmanak.mealient.datasource.v0.models
|
||||||
|
|
||||||
import kotlinx.datetime.LocalDate
|
|
||||||
import kotlinx.datetime.LocalDateTime
|
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
@@ -9,14 +7,6 @@ import kotlinx.serialization.Serializable
|
|||||||
data class GetRecipeResponseV0(
|
data class GetRecipeResponseV0(
|
||||||
@SerialName("id") val remoteId: Int,
|
@SerialName("id") val remoteId: Int,
|
||||||
@SerialName("name") val name: String,
|
@SerialName("name") val name: String,
|
||||||
@SerialName("slug") val slug: String,
|
|
||||||
@SerialName("image") val image: String,
|
|
||||||
@SerialName("description") val description: String = "",
|
|
||||||
@SerialName("recipeCategory") val recipeCategories: List<String>,
|
|
||||||
@SerialName("tags") val tags: List<String>,
|
|
||||||
@SerialName("rating") val rating: Int?,
|
|
||||||
@SerialName("dateAdded") val dateAdded: LocalDate,
|
|
||||||
@SerialName("dateUpdated") val dateUpdated: LocalDateTime,
|
|
||||||
@SerialName("recipeYield") val recipeYield: String = "",
|
@SerialName("recipeYield") val recipeYield: String = "",
|
||||||
@SerialName("recipeIngredient") val recipeIngredients: List<GetRecipeIngredientResponseV0>,
|
@SerialName("recipeIngredient") val recipeIngredients: List<GetRecipeIngredientResponseV0>,
|
||||||
@SerialName("recipeInstructions") val recipeInstructions: List<GetRecipeInstructionResponseV0>,
|
@SerialName("recipeInstructions") val recipeInstructions: List<GetRecipeInstructionResponseV0>,
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package gq.kirmanak.mealient.datasource.v1.models
|
package gq.kirmanak.mealient.datasource.v1.models
|
||||||
|
|
||||||
import kotlinx.datetime.LocalDate
|
|
||||||
import kotlinx.datetime.LocalDateTime
|
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
@@ -9,14 +7,6 @@ import kotlinx.serialization.Serializable
|
|||||||
data class GetRecipeResponseV1(
|
data class GetRecipeResponseV1(
|
||||||
@SerialName("id") val remoteId: String,
|
@SerialName("id") val remoteId: String,
|
||||||
@SerialName("name") val name: String,
|
@SerialName("name") val name: String,
|
||||||
@SerialName("slug") val slug: String,
|
|
||||||
@SerialName("image") val image: String? = null,
|
|
||||||
@SerialName("description") val description: String = "",
|
|
||||||
@SerialName("recipeCategory") val recipeCategories: List<String>,
|
|
||||||
@SerialName("tags") val tags: List<String>,
|
|
||||||
@SerialName("rating") val rating: Int?,
|
|
||||||
@SerialName("dateAdded") val dateAdded: LocalDate,
|
|
||||||
@SerialName("dateUpdated") val dateUpdated: LocalDateTime,
|
|
||||||
@SerialName("recipeYield") val recipeYield: String = "",
|
@SerialName("recipeYield") val recipeYield: String = "",
|
||||||
@SerialName("recipeIngredient") val recipeIngredients: List<GetRecipeIngredientResponseV1>,
|
@SerialName("recipeIngredient") val recipeIngredients: List<GetRecipeIngredientResponseV1>,
|
||||||
@SerialName("recipeInstructions") val recipeInstructions: List<GetRecipeInstructionResponseV1>,
|
@SerialName("recipeInstructions") val recipeInstructions: List<GetRecipeInstructionResponseV1>,
|
||||||
|
|||||||
@@ -6,48 +6,25 @@ import kotlinx.serialization.Serializable
|
|||||||
@Serializable
|
@Serializable
|
||||||
data class UpdateRecipeRequestV1(
|
data class UpdateRecipeRequestV1(
|
||||||
@SerialName("description") val description: String = "",
|
@SerialName("description") val description: String = "",
|
||||||
@SerialName("image") val image: String = "",
|
|
||||||
@SerialName("recipeYield") val recipeYield: String = "",
|
@SerialName("recipeYield") val recipeYield: String = "",
|
||||||
@SerialName("recipeIngredient") val recipeIngredient: List<AddRecipeIngredientV1> = emptyList(),
|
@SerialName("recipeIngredient") val recipeIngredient: List<AddRecipeIngredientV1> = emptyList(),
|
||||||
@SerialName("recipeInstructions") val recipeInstructions: List<AddRecipeInstructionV1> = emptyList(),
|
@SerialName("recipeInstructions") val recipeInstructions: List<AddRecipeInstructionV1> = emptyList(),
|
||||||
@SerialName("filePath") val filePath: String = "",
|
|
||||||
@SerialName("tags") val tags: List<String> = emptyList(),
|
|
||||||
@SerialName("categories") val categories: List<String> = emptyList(),
|
|
||||||
@SerialName("notes") val notes: List<AddRecipeNoteV1> = emptyList(),
|
|
||||||
@SerialName("extras") val extras: Map<String, String> = emptyMap(),
|
|
||||||
@SerialName("assets") val assets: List<String> = emptyList(),
|
|
||||||
@SerialName("settings") val settings: AddRecipeSettingsV1 = AddRecipeSettingsV1(),
|
@SerialName("settings") val settings: AddRecipeSettingsV1 = AddRecipeSettingsV1(),
|
||||||
)
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class AddRecipeIngredientV1(
|
data class AddRecipeIngredientV1(
|
||||||
@SerialName("disableAmount") val disableAmount: Boolean = true,
|
|
||||||
@SerialName("food") val food: String? = null,
|
|
||||||
@SerialName("note") val note: String = "",
|
@SerialName("note") val note: String = "",
|
||||||
@SerialName("quantity") val quantity: Int = 1,
|
|
||||||
@SerialName("title") val title: String? = null,
|
|
||||||
@SerialName("unit") val unit: String? = null,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class AddRecipeInstructionV1(
|
data class AddRecipeInstructionV1(
|
||||||
@SerialName("title") val title: String = "",
|
|
||||||
@SerialName("text") val text: String = "",
|
@SerialName("text") val text: String = "",
|
||||||
@SerialName("ingredientReferences") val ingredientReferences: List<String> = emptyList(),
|
@SerialName("ingredientReferences") val ingredientReferences: List<String> = emptyList(),
|
||||||
)
|
)
|
||||||
|
|
||||||
@Serializable
|
|
||||||
data class AddRecipeNoteV1(
|
|
||||||
@SerialName("title") val title: String = "",
|
|
||||||
@SerialName("text") val text: String = "",
|
|
||||||
)
|
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class AddRecipeSettingsV1(
|
data class AddRecipeSettingsV1(
|
||||||
@SerialName("disableAmount") val disableAmount: Boolean = true,
|
|
||||||
@SerialName("disableComments") val disableComments: Boolean = false,
|
@SerialName("disableComments") val disableComments: Boolean = false,
|
||||||
@SerialName("landscapeView") val landscapeView: Boolean = true,
|
|
||||||
@SerialName("public") val public: Boolean = true,
|
@SerialName("public") val public: Boolean = true,
|
||||||
@SerialName("showAssets") val showAssets: Boolean = true,
|
|
||||||
@SerialName("showNutrition") val showNutrition: Boolean = true,
|
|
||||||
)
|
)
|
||||||
Reference in New Issue
Block a user