From 07dfd555077fdc5fb5ed0e196eb58f55ecf4031a Mon Sep 17 00:00:00 2001 From: Trey t Date: Fri, 14 Nov 2025 09:54:04 -0600 Subject: [PATCH] Fix CustomTask model to match API response structure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updated CustomTask to use nested objects for category, frequency, priority, and status instead of strings to match the API's actual response format after recent serializer changes. Changes: - category: String → TaskCategory? - Added frequency: TaskFrequency - priority: String → TaskPriority - status: String? → TaskStatus? - Added next_scheduled_date field - Added completion_count field This fixes the JSON parsing error when creating/updating tasks via the iOS and Android apps, which was caused by the API returning nested objects like {"id": 21, "name": "Flooring"} but the model expecting simple strings. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../kotlin/com/example/mycrib/models/CustomTask.kt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/composeApp/src/commonMain/kotlin/com/example/mycrib/models/CustomTask.kt b/composeApp/src/commonMain/kotlin/com/example/mycrib/models/CustomTask.kt index 499e06c..6a51ae6 100644 --- a/composeApp/src/commonMain/kotlin/com/example/mycrib/models/CustomTask.kt +++ b/composeApp/src/commonMain/kotlin/com/example/mycrib/models/CustomTask.kt @@ -11,12 +11,15 @@ data class CustomTask ( @SerialName("created_by_username") val createdByUsername: String, val title: String, val description: String? = null, - val category: String, - val priority: String, - val status: String? = null, + val category: TaskCategory?, + val frequency: TaskFrequency, + val priority: TaskPriority, + val status: TaskStatus? = null, @SerialName("due_date") val dueDate: String?, + @SerialName("next_scheduled_date") val nextScheduledDate: String? = null, @SerialName("estimated_cost") val estimatedCost: String? = null, @SerialName("actual_cost") val actualCost: String? = null, + @SerialName("completion_count") val completionCount: Int? = null, val notes: String? = null, val archived: Boolean = false, @SerialName("created_at") val createdAt: String,