Fix API contract mismatches with Go backend

- Document.purchasePrice: String? → Double? (matches Go decimal.Decimal)
- TaskTemplate: add regionId/regionName (Go returns these, KMM was ignoring)
- TaskResponse.completions: add comment explaining separate fetch pattern
- Document: add comments clarifying fileUrl vs mediaUrl usage
This commit is contained in:
Trey T
2026-03-26 17:06:36 -05:00
parent e4dc3ac30b
commit 4d363ca44e
3 changed files with 15 additions and 6 deletions

View File

@@ -55,6 +55,9 @@ data class TaskResponse(
@SerialName("parent_task_id") val parentTaskId: Int? = null, @SerialName("parent_task_id") val parentTaskId: Int? = null,
@SerialName("completion_count") val completionCount: Int = 0, @SerialName("completion_count") val completionCount: Int = 0,
@SerialName("kanban_column") val kanbanColumn: String? = null, // Which kanban column this task belongs to @SerialName("kanban_column") val kanbanColumn: String? = null, // Which kanban column this task belongs to
// Note: Go API does not return completions inline with TaskResponse.
// Completions are fetched separately via the completions endpoint.
// This field defaults to emptyList() and is only populated client-side after a separate fetch.
val completions: List<TaskCompletionResponse> = emptyList(), val completions: List<TaskCompletionResponse> = emptyList(),
@SerialName("created_at") val createdAt: String, @SerialName("created_at") val createdAt: String,
@SerialName("updated_at") val updatedAt: String @SerialName("updated_at") val updatedAt: String

View File

@@ -33,8 +33,12 @@ data class Document(
val title: String, val title: String,
@SerialName("document_type") val documentType: String, @SerialName("document_type") val documentType: String,
val description: String? = null, val description: String? = null,
@SerialName("file_url") val fileUrl: String? = null, // URL to the file // fileUrl: raw storage path (internal). Not included in Go DocumentResponse DTO —
@SerialName("media_url") val mediaUrl: String? = null, // Authenticated endpoint: /api/media/document/{id} // will always be null from the API. Kept for backward compatibility; prefer mediaUrl.
@SerialName("file_url") val fileUrl: String? = null,
// mediaUrl: authenticated endpoint clients should use (e.g. /api/media/document/{id}).
// This is the URL the Go API actually returns for document access.
@SerialName("media_url") val mediaUrl: String? = null,
@SerialName("file_name") val fileName: String? = null, @SerialName("file_name") val fileName: String? = null,
@SerialName("file_size") val fileSize: Int? = null, @SerialName("file_size") val fileSize: Int? = null,
@SerialName("mime_type") val mimeType: String? = null, @SerialName("mime_type") val mimeType: String? = null,
@@ -43,7 +47,7 @@ data class Document(
@SerialName("serial_number") val serialNumber: String? = null, @SerialName("serial_number") val serialNumber: String? = null,
val vendor: String? = null, val vendor: String? = null,
@SerialName("purchase_date") val purchaseDate: String? = null, @SerialName("purchase_date") val purchaseDate: String? = null,
@SerialName("purchase_price") val purchasePrice: String? = null, @SerialName("purchase_price") val purchasePrice: Double? = null,
@SerialName("expiry_date") val expiryDate: String? = null, @SerialName("expiry_date") val expiryDate: String? = null,
// Relationships // Relationships
@SerialName("residence_id") val residenceId: Int? = null, @SerialName("residence_id") val residenceId: Int? = null,
@@ -87,7 +91,7 @@ data class DocumentCreateRequest(
@SerialName("serial_number") val serialNumber: String? = null, @SerialName("serial_number") val serialNumber: String? = null,
val vendor: String? = null, val vendor: String? = null,
@SerialName("purchase_date") val purchaseDate: String? = null, @SerialName("purchase_date") val purchaseDate: String? = null,
@SerialName("purchase_price") val purchasePrice: String? = null, @SerialName("purchase_price") val purchasePrice: Double? = null,
@SerialName("expiry_date") val expiryDate: String? = null, @SerialName("expiry_date") val expiryDate: String? = null,
// Relationships // Relationships
@SerialName("residence_id") val residenceId: Int, @SerialName("residence_id") val residenceId: Int,
@@ -106,7 +110,7 @@ data class DocumentUpdateRequest(
@SerialName("serial_number") val serialNumber: String? = null, @SerialName("serial_number") val serialNumber: String? = null,
val vendor: String? = null, val vendor: String? = null,
@SerialName("purchase_date") val purchaseDate: String? = null, @SerialName("purchase_date") val purchaseDate: String? = null,
@SerialName("purchase_price") val purchasePrice: String? = null, @SerialName("purchase_price") val purchasePrice: Double? = null,
@SerialName("expiry_date") val expiryDate: String? = null, @SerialName("expiry_date") val expiryDate: String? = null,
// Relationships // Relationships
@SerialName("task_id") val taskId: Int? = null @SerialName("task_id") val taskId: Int? = null

View File

@@ -20,7 +20,9 @@ data class TaskTemplate(
@SerialName("icon_android") val iconAndroid: String = "", @SerialName("icon_android") val iconAndroid: String = "",
val tags: List<String> = emptyList(), val tags: List<String> = emptyList(),
@SerialName("display_order") val displayOrder: Int = 0, @SerialName("display_order") val displayOrder: Int = 0,
@SerialName("is_active") val isActive: Boolean = true @SerialName("is_active") val isActive: Boolean = true,
@SerialName("region_id") val regionId: Int? = null,
@SerialName("region_name") val regionName: String? = null
) { ) {
/** /**
* Human-readable frequency display * Human-readable frequency display