Group items in shopping lists based on labels (#319)

* Add data classes to hold food label information

- Created `GetFoodLabelResponse` data class to represent food label details
- Updated `GetFoodResponse` to include `label` property of type `GetFoodLabelResponse`

* Add backend to sort items in shopping lists by label

* Add UI code to sort items in shopping lists by label

* Use label from ShoppingListItem instead of Food

* Use list for ShoppingListItems and labels storage

* Fix incorrect routing code

* Only add DefaultLabel if there are items with a label

* Small improvements to comments and formatting
This commit is contained in:
Erik
2024-09-07 22:01:02 +02:00
committed by GitHub
parent 5aa2327c01
commit 7c825970ea
15 changed files with 250 additions and 35 deletions

View File

@@ -0,0 +1,12 @@
package gq.kirmanak.mealient.datasource.models
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class GetItemLabelResponse(
@SerialName("name") val name: String,
@SerialName("color") val color: String,
@SerialName("groupId") val grpId: String,
@SerialName("id") val id: String
)

View File

@@ -23,6 +23,7 @@ data class GetShoppingListItemResponse(
@SerialName("quantity") val quantity: Double = 0.0,
@SerialName("unit") val unit: GetUnitResponse? = null,
@SerialName("food") val food: GetFoodResponse? = null,
@SerialName("label") val label: GetItemLabelResponse? = null,
@SerialName("recipeReferences") val recipeReferences: List<GetShoppingListItemRecipeReferenceResponse> = emptyList(),
)