Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties
import com.fasterxml.jackson.annotation.JsonProperty
import com.github.jasminb.jsonapi.StringIdHandler
import com.github.jasminb.jsonapi.annotations.Id
import com.github.jasminb.jsonapi.annotations.Relationship
import com.github.jasminb.jsonapi.annotations.Type
import com.ctrlhub.core.settings.timebands.response.TimeBand

@Type("appointments")
@JsonIgnoreProperties(ignoreUnknown = true)
Expand All @@ -17,7 +19,9 @@ class Appointment @JsonCreator constructor(
@JsonProperty("notes") val notes: String = "",
@JsonProperty("on_ecr") val onEcr: Boolean = false,
@JsonProperty("on_ecr_notes") val onEcrNotes: String = "",
@JsonProperty("start_time") val startTime: String = ""
@JsonProperty("start_time") val startTime: String = "",
@Relationship("time_band")
var timeBand: TimeBand? = null
) {
constructor() : this(
id = "",
Expand All @@ -27,6 +31,7 @@ class Appointment @JsonCreator constructor(
notes = "",
onEcr = false,
onEcrNotes = "",
startTime = ""
startTime = "",
timeBand = null
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import com.ctrlhub.core.geo.Property
import com.ctrlhub.core.projects.appointments.response.Appointment
import com.ctrlhub.core.projects.operations.templates.response.OperationTemplate
import com.ctrlhub.core.projects.response.Label
import com.ctrlhub.core.settings.timebands.response.TimeBand
import com.fasterxml.jackson.annotation.JsonCreator
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
import com.fasterxml.jackson.annotation.JsonProperty
Expand Down Expand Up @@ -68,4 +69,3 @@ data class OperationFormRequirement(
@JsonProperty("id") val formId: String,
@JsonProperty("required") val required: Boolean
)

Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ class OperationsRouterTest {
assertEquals("appointment-1", appointment?.id)
assertEquals("2025-08-15T07:00:00Z", appointment?.startTime)
assertEquals("2025-08-15T11:00:00Z", appointment?.endTime)

// Validate the timeband relationship is hydrated (just the ID)
assertNotNull(appointment?.timeBand, "TimeBand should not be null")
assertEquals("timeband-1", appointment?.timeBand?.id)
}
}
}
Loading