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
5
5
import com.fasterxml.jackson.annotation.JsonProperty
6
6
import com.github.jasminb.jsonapi.StringIdHandler
7
7
import com.github.jasminb.jsonapi.annotations.Id
8
+ import com.github.jasminb.jsonapi.annotations.Relationship
8
9
import com.github.jasminb.jsonapi.annotations.Type
10
+ import com.ctrlhub.core.settings.timebands.response.TimeBand
9
11
10
12
@Type(" appointments" )
11
13
@JsonIgnoreProperties(ignoreUnknown = true )
@@ -17,7 +19,9 @@ class Appointment @JsonCreator constructor(
17
19
@JsonProperty(" notes" ) val notes : String = " " ,
18
20
@JsonProperty(" on_ecr" ) val onEcr : Boolean = false ,
19
21
@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
21
25
) {
22
26
constructor () : this (
23
27
id = " " ,
@@ -27,6 +31,7 @@ class Appointment @JsonCreator constructor(
27
31
notes = " " ,
28
32
onEcr = false ,
29
33
onEcrNotes = " " ,
30
- startTime = " "
34
+ startTime = " " ,
35
+ timeBand = null
31
36
)
32
37
}
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import com.ctrlhub.core.geo.Property
5
5
import com.ctrlhub.core.projects.appointments.response.Appointment
6
6
import com.ctrlhub.core.projects.operations.templates.response.OperationTemplate
7
7
import com.ctrlhub.core.projects.response.Label
8
+ import com.ctrlhub.core.settings.timebands.response.TimeBand
8
9
import com.fasterxml.jackson.annotation.JsonCreator
9
10
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
10
11
import com.fasterxml.jackson.annotation.JsonProperty
@@ -68,4 +69,3 @@ data class OperationFormRequirement(
68
69
@JsonProperty(" id" ) val formId : String ,
69
70
@JsonProperty(" required" ) val required : Boolean
70
71
)
71
-
Original file line number Diff line number Diff line change @@ -135,6 +135,10 @@ class OperationsRouterTest {
135
135
assertEquals(" appointment-1" , appointment?.id)
136
136
assertEquals(" 2025-08-15T07:00:00Z" , appointment?.startTime)
137
137
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)
138
142
}
139
143
}
140
144
}
You can’t perform that action at this time.
0 commit comments