Update Kotlin models and iOS Swift to align with new Go API format

- Update all Kotlin API models to match Go API response structures
- Fix Swift type aliases (TaskDetail→TaskResponse, Residence→ResidenceResponse, etc.)
- Update TaskCompletionCreateRequest to simplified Go API format (taskId, notes, actualCost, photoUrl)
- Fix optional handling for frequency, priority, category, status in task models
- Replace isPrimaryOwner with ownerId comparison against current user
- Update ResidenceUsersResponse to use owner.id instead of ownerId
- Fix non-optional String fields to use isEmpty checks instead of optional binding
- Add type aliases for backwards compatibility in Kotlin models

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Trey t
2025-11-27 11:03:00 -06:00
parent d3e77326aa
commit 60c824447d
48 changed files with 923 additions and 846 deletions

View File

@@ -2,7 +2,7 @@ import SwiftUI
import ComposeApp
struct ResidenceFormView: View {
let existingResidence: Residence?
let existingResidence: ResidenceResponse?
@Binding var isPresented: Bool
var onSuccess: (() -> Void)?
@StateObject private var viewModel = ResidenceViewModel()
@@ -233,8 +233,8 @@ struct ResidenceFormView: View {
isPrimary = residence.isPrimary
// Set the selected property type
if let propertyTypeStr = residence.propertyType, let propertyTypeId = Int(propertyTypeStr) {
selectedPropertyType = residenceTypes.first { $0.id == propertyTypeId }
if let propertyTypeId = residence.propertyTypeId {
selectedPropertyType = residenceTypes.first { $0.id == Int32(propertyTypeId) }
}
}
// In add mode, leave selectedPropertyType as nil to force user to select
@@ -261,17 +261,17 @@ struct ResidenceFormView: View {
guard !bedrooms.isEmpty, let value = Int32(bedrooms) else { return nil }
return KotlinInt(int: value)
}()
let bathroomsValue: KotlinFloat? = {
guard !bathrooms.isEmpty, let value = Float(bathrooms) else { return nil }
return KotlinFloat(float: value)
let bathroomsValue: KotlinDouble? = {
guard !bathrooms.isEmpty, let value = Double(bathrooms) else { return nil }
return KotlinDouble(double: value)
}()
let squareFootageValue: KotlinInt? = {
guard !squareFootage.isEmpty, let value = Int32(squareFootage) else { return nil }
return KotlinInt(int: value)
}()
let lotSizeValue: KotlinFloat? = {
guard !lotSize.isEmpty, let value = Float(lotSize) else { return nil }
return KotlinFloat(float: value)
let lotSizeValue: KotlinDouble? = {
guard !lotSize.isEmpty, let value = Double(lotSize) else { return nil }
return KotlinDouble(double: value)
}()
let yearBuiltValue: KotlinInt? = {
guard !yearBuilt.isEmpty, let value = Int32(yearBuilt) else { return nil }
@@ -286,7 +286,7 @@ struct ResidenceFormView: View {
let request = ResidenceCreateRequest(
name: name,
propertyType: propertyTypeValue,
propertyTypeId: propertyTypeValue,
streetAddress: streetAddress.isEmpty ? nil : streetAddress,
apartmentUnit: apartmentUnit.isEmpty ? nil : apartmentUnit,
city: city.isEmpty ? nil : city,
@@ -301,7 +301,7 @@ struct ResidenceFormView: View {
description: description.isEmpty ? nil : description,
purchaseDate: nil,
purchasePrice: nil,
isPrimary: isPrimary
isPrimary: KotlinBoolean(bool: isPrimary)
)
if let residence = existingResidence {