Fix Document API field names to match Go backend
- Change residence to residence_id with @SerialName annotation - Change contractor to contractor_id with @SerialName annotation - Update DocumentApi.kt to use correct field names in form data and JSON requests - Fixes iOS document creation failing with "missing residence_id" error 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -80,8 +80,9 @@ data class DocumentCreateRequest(
|
||||
@SerialName("start_date") val startDate: String? = null,
|
||||
@SerialName("end_date") val endDate: String? = null,
|
||||
// Relationships
|
||||
val residence: Int,
|
||||
val contractor: Int? = null,
|
||||
@SerialName("residence_id") val residenceId: Int,
|
||||
@SerialName("contractor_id") val contractorId: Int? = null,
|
||||
@SerialName("task_id") val taskId: Int? = null,
|
||||
// Images
|
||||
@SerialName("image_urls") val imageUrls: List<String>? = null,
|
||||
// Metadata
|
||||
@@ -110,7 +111,7 @@ data class DocumentUpdateRequest(
|
||||
@SerialName("start_date") val startDate: String? = null,
|
||||
@SerialName("end_date") val endDate: String? = null,
|
||||
// Relationships
|
||||
val contractor: Int? = null,
|
||||
@SerialName("contractor_id") val contractorId: Int? = null,
|
||||
// Metadata
|
||||
val tags: String? = null,
|
||||
val notes: String? = null,
|
||||
|
||||
@@ -102,12 +102,12 @@ class DocumentApi(private val client: HttpClient = ApiClient.httpClient) {
|
||||
formData = formData {
|
||||
append("title", title)
|
||||
append("document_type", documentType)
|
||||
append("residence", residenceId.toString())
|
||||
append("residence_id", residenceId.toString())
|
||||
description?.let { append("description", it) }
|
||||
category?.let { append("category", it) }
|
||||
tags?.let { append("tags", it) }
|
||||
notes?.let { append("notes", it) }
|
||||
contractorId?.let { append("contractor", it.toString()) }
|
||||
contractorId?.let { append("contractor_id", it.toString()) }
|
||||
append("is_active", isActive.toString())
|
||||
// Warranty fields
|
||||
itemName?.let { append("item_name", it) }
|
||||
@@ -159,8 +159,8 @@ class DocumentApi(private val client: HttpClient = ApiClient.httpClient) {
|
||||
purchaseDate = purchaseDate,
|
||||
startDate = startDate,
|
||||
endDate = endDate,
|
||||
residence = residenceId,
|
||||
contractor = contractorId,
|
||||
residenceId = residenceId,
|
||||
contractorId = contractorId,
|
||||
tags = tags,
|
||||
notes = notes,
|
||||
isActive = isActive
|
||||
@@ -227,7 +227,7 @@ class DocumentApi(private val client: HttpClient = ApiClient.httpClient) {
|
||||
category?.let { append("category", it) }
|
||||
tags?.let { append("tags", it) }
|
||||
notes?.let { append("notes", it) }
|
||||
contractorId?.let { append("contractor", it.toString()) }
|
||||
contractorId?.let { append("contractor_id", it.toString()) }
|
||||
isActive?.let { append("is_active", it.toString()) }
|
||||
// Warranty fields
|
||||
itemName?.let { append("item_name", it) }
|
||||
@@ -268,7 +268,7 @@ class DocumentApi(private val client: HttpClient = ApiClient.httpClient) {
|
||||
purchaseDate = purchaseDate,
|
||||
startDate = startDate,
|
||||
endDate = endDate,
|
||||
contractor = contractorId,
|
||||
contractorId = contractorId,
|
||||
tags = tags,
|
||||
notes = notes,
|
||||
isActive = isActive
|
||||
|
||||
Reference in New Issue
Block a user