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("start_date") val startDate: String? = null,
|
||||||
@SerialName("end_date") val endDate: String? = null,
|
@SerialName("end_date") val endDate: String? = null,
|
||||||
// Relationships
|
// Relationships
|
||||||
val residence: Int,
|
@SerialName("residence_id") val residenceId: Int,
|
||||||
val contractor: Int? = null,
|
@SerialName("contractor_id") val contractorId: Int? = null,
|
||||||
|
@SerialName("task_id") val taskId: Int? = null,
|
||||||
// Images
|
// Images
|
||||||
@SerialName("image_urls") val imageUrls: List<String>? = null,
|
@SerialName("image_urls") val imageUrls: List<String>? = null,
|
||||||
// Metadata
|
// Metadata
|
||||||
@@ -110,7 +111,7 @@ data class DocumentUpdateRequest(
|
|||||||
@SerialName("start_date") val startDate: String? = null,
|
@SerialName("start_date") val startDate: String? = null,
|
||||||
@SerialName("end_date") val endDate: String? = null,
|
@SerialName("end_date") val endDate: String? = null,
|
||||||
// Relationships
|
// Relationships
|
||||||
val contractor: Int? = null,
|
@SerialName("contractor_id") val contractorId: Int? = null,
|
||||||
// Metadata
|
// Metadata
|
||||||
val tags: String? = null,
|
val tags: String? = null,
|
||||||
val notes: String? = null,
|
val notes: String? = null,
|
||||||
|
|||||||
@@ -102,12 +102,12 @@ class DocumentApi(private val client: HttpClient = ApiClient.httpClient) {
|
|||||||
formData = formData {
|
formData = formData {
|
||||||
append("title", title)
|
append("title", title)
|
||||||
append("document_type", documentType)
|
append("document_type", documentType)
|
||||||
append("residence", residenceId.toString())
|
append("residence_id", residenceId.toString())
|
||||||
description?.let { append("description", it) }
|
description?.let { append("description", it) }
|
||||||
category?.let { append("category", it) }
|
category?.let { append("category", it) }
|
||||||
tags?.let { append("tags", it) }
|
tags?.let { append("tags", it) }
|
||||||
notes?.let { append("notes", it) }
|
notes?.let { append("notes", it) }
|
||||||
contractorId?.let { append("contractor", it.toString()) }
|
contractorId?.let { append("contractor_id", it.toString()) }
|
||||||
append("is_active", isActive.toString())
|
append("is_active", isActive.toString())
|
||||||
// Warranty fields
|
// Warranty fields
|
||||||
itemName?.let { append("item_name", it) }
|
itemName?.let { append("item_name", it) }
|
||||||
@@ -159,8 +159,8 @@ class DocumentApi(private val client: HttpClient = ApiClient.httpClient) {
|
|||||||
purchaseDate = purchaseDate,
|
purchaseDate = purchaseDate,
|
||||||
startDate = startDate,
|
startDate = startDate,
|
||||||
endDate = endDate,
|
endDate = endDate,
|
||||||
residence = residenceId,
|
residenceId = residenceId,
|
||||||
contractor = contractorId,
|
contractorId = contractorId,
|
||||||
tags = tags,
|
tags = tags,
|
||||||
notes = notes,
|
notes = notes,
|
||||||
isActive = isActive
|
isActive = isActive
|
||||||
@@ -227,7 +227,7 @@ class DocumentApi(private val client: HttpClient = ApiClient.httpClient) {
|
|||||||
category?.let { append("category", it) }
|
category?.let { append("category", it) }
|
||||||
tags?.let { append("tags", it) }
|
tags?.let { append("tags", it) }
|
||||||
notes?.let { append("notes", 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()) }
|
isActive?.let { append("is_active", it.toString()) }
|
||||||
// Warranty fields
|
// Warranty fields
|
||||||
itemName?.let { append("item_name", it) }
|
itemName?.let { append("item_name", it) }
|
||||||
@@ -268,7 +268,7 @@ class DocumentApi(private val client: HttpClient = ApiClient.httpClient) {
|
|||||||
purchaseDate = purchaseDate,
|
purchaseDate = purchaseDate,
|
||||||
startDate = startDate,
|
startDate = startDate,
|
||||||
endDate = endDate,
|
endDate = endDate,
|
||||||
contractor = contractorId,
|
contractorId = contractorId,
|
||||||
tags = tags,
|
tags = tags,
|
||||||
notes = notes,
|
notes = notes,
|
||||||
isActive = isActive
|
isActive = isActive
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"images" : [
|
"images" : [
|
||||||
{
|
{
|
||||||
"filename" : "logo_primary.png",
|
"filename" : "mycrib-icon@2x.png",
|
||||||
"idiom" : "universal",
|
"idiom" : "universal",
|
||||||
"platform" : "ios",
|
"platform" : "ios",
|
||||||
"size" : "1024x1024"
|
"size" : "1024x1024"
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 21 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 638 KiB |
Reference in New Issue
Block a user