Update client models to handle numeric decimals from optimized API
Model type updates: - Change decimal cost fields from String to Double for better type safety - actualCost: String? → Double? (TaskCompletion, TaskCompletionCreateRequest) - estimatedCost: String? → Double? (CustomTask, TaskCreateRequest, TaskDetail) - purchasePrice: String? → Double? (Residence, ResidenceCreateRequest) TaskDetail model fixes: - Add missing residenceName, createdBy, createdByUsername fields - Add missing intervalDays field to match backend response - Remove actualCost and notes fields (not in backend TaskDetailSerializer) - Ensure 100% compatibility with Django API TaskDetailSerializer UI input/output conversions: - EditTaskScreen: Convert Double to String for display, String to Double for API - AddTaskDialog: Convert String input to Double for API requests - CompleteTaskDialog: Convert String input to Double for API requests - App.kt: Handle type conversions in navigation route parameters Display improvements: - TaskCard: Update preview data to use numeric literals (150.00 vs "150.00") - Cost display already handles Double correctly with string interpolation Benefits: - Type-safe numeric handling throughout the app - Smaller JSON payloads (numbers vs quoted strings) - Better performance with direct numeric deserialization - Aligns with REST API best practices - 100% backend compatibility verified Testing: - All models now match backend serializer field types exactly - Build successful with no errors - Ready for integration with optimized Django API 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -25,7 +25,7 @@ data class Residence(
|
||||
@SerialName("year_built") val yearBuilt: Int?,
|
||||
val description: String?,
|
||||
@SerialName("purchase_date") val purchaseDate: String?,
|
||||
@SerialName("purchase_price") val purchasePrice: String?,
|
||||
@SerialName("purchase_price") val purchasePrice: Double?,
|
||||
@SerialName("is_primary") val isPrimary: Boolean = false,
|
||||
@SerialName("created_at") val createdAt: String,
|
||||
@SerialName("updated_at") val updatedAt: String
|
||||
@@ -133,7 +133,7 @@ data class ResidenceWithTasks(
|
||||
@SerialName("year_built") val yearBuilt: Int?,
|
||||
val description: String?,
|
||||
@SerialName("purchase_date") val purchaseDate: String?,
|
||||
@SerialName("purchase_price") val purchasePrice: String?,
|
||||
@SerialName("purchase_price") val purchasePrice: Double?,
|
||||
@SerialName("is_primary") val isPrimary: Boolean,
|
||||
@SerialName("task_summary") val taskSummary: TaskSummary,
|
||||
val tasks: List<TaskDetail>,
|
||||
|
||||
Reference in New Issue
Block a user