File tree Expand file tree Collapse file tree 3 files changed +12
-3
lines changed
main/kotlin/com/ctrlhub/core/projects
test/kotlin/com/ctrlhub/core/projects/operations Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties
55import com.fasterxml.jackson.annotation.JsonProperty
66import com.github.jasminb.jsonapi.StringIdHandler
77import com.github.jasminb.jsonapi.annotations.Id
8+ import com.github.jasminb.jsonapi.annotations.Relationship
89import com.github.jasminb.jsonapi.annotations.Type
10+ import com.ctrlhub.core.settings.timebands.response.TimeBand
911
1012@Type(" appointments" )
1113@JsonIgnoreProperties(ignoreUnknown = true )
@@ -17,7 +19,9 @@ class Appointment @JsonCreator constructor(
1719 @JsonProperty(" notes" ) val notes : String = " " ,
1820 @JsonProperty(" on_ecr" ) val onEcr : Boolean = false ,
1921 @JsonProperty(" on_ecr_notes" ) val onEcrNotes : String = " " ,
20- @JsonProperty(" start_time" ) val startTime : String = " "
22+ @JsonProperty(" start_time" ) val startTime : String = " " ,
23+ @Relationship(" time_band" )
24+ var timeBand : TimeBand ? = null
2125) {
2226 constructor () : this (
2327 id = " " ,
@@ -27,6 +31,7 @@ class Appointment @JsonCreator constructor(
2731 notes = " " ,
2832 onEcr = false ,
2933 onEcrNotes = " " ,
30- startTime = " "
34+ startTime = " " ,
35+ timeBand = null
3136 )
3237}
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import com.ctrlhub.core.geo.Property
55import com.ctrlhub.core.projects.appointments.response.Appointment
66import com.ctrlhub.core.projects.operations.templates.response.OperationTemplate
77import com.ctrlhub.core.projects.response.Label
8+ import com.ctrlhub.core.settings.timebands.response.TimeBand
89import com.fasterxml.jackson.annotation.JsonCreator
910import com.fasterxml.jackson.annotation.JsonIgnoreProperties
1011import com.fasterxml.jackson.annotation.JsonProperty
@@ -68,4 +69,3 @@ data class OperationFormRequirement(
6869 @JsonProperty(" id" ) val formId : String ,
6970 @JsonProperty(" required" ) val required : Boolean
7071)
71-
Original file line number Diff line number Diff line change @@ -135,6 +135,10 @@ class OperationsRouterTest {
135135 assertEquals(" appointment-1" , appointment?.id)
136136 assertEquals(" 2025-08-15T07:00:00Z" , appointment?.startTime)
137137 assertEquals(" 2025-08-15T11:00:00Z" , appointment?.endTime)
138+
139+ // Validate the timeband relationship is hydrated (just the ID)
140+ assertNotNull(appointment?.timeBand, " TimeBand should not be null" )
141+ assertEquals(" timeband-1" , appointment?.timeBand?.id)
138142 }
139143 }
140144}
You can’t perform that action at this time.
0 commit comments