From 1fc6bf03c3ef9f891ffbbe50dea17eed37e3fd9b Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Sun, 21 Apr 2024 23:01:20 +0100 Subject: [PATCH] Update service to use service ddetail struct --- pkg/database/timetable.go | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/pkg/database/timetable.go b/pkg/database/timetable.go index d698086..38c4740 100644 --- a/pkg/database/timetable.go +++ b/pkg/database/timetable.go @@ -17,22 +17,20 @@ type Stop struct { DepLine string `json:"depLine,omitempty"` } -type Service struct { // Consider including catering, train class etc. here too. - TransactionType string `json:"transactionType,omitempty"` - StpIndicator string `json:"stpIndicator,omitempty"` - Vstp bool `json:"vstp"` - Operator string `json:"operator,omitempty"` - TrainUid string `json:"trainUid,omitempty"` - Headcode string `json:"headcode,omitempty"` - PowerType string `json:"powerType,omitempty"` - PlanSpeed int32 `json:"planSpeed,omitempty"` - ScheduleStartDate time.Time `json:"scheduleStartDate,omitempty"` - ScheduleEndDate time.Time `json:"scheduleEndDate,omitempty"` - FirstClass bool `json:"firstClass"` // Ensure omitempty is not set - Catering bool `json:"catering"` // Ensure omitempty is not set - Sleeper bool `json:"sleeper"` // Ensure omitempty is not set - DaysRun []string `json:"daysRun,omitempty"` - Stops []Stop `json:"stops,omitempty"` +// Defined the Database Document format +type Service struct { + TransactionType string `json:"transactionType,omitempty"` + StpIndicator string `json:"stpIndicator,omitempty"` + Operator string `json:"operator,omitempty"` + TrainUid string `json:"trainUid,omitempty"` + Headcode string `json:"headcode,omitempty"` + PowerType string `json:"powerType,omitempty"` + PlanSpeed int32 `json:"planSpeed,omitempty"` + ScheduleStartDate time.Time `json:"scheduleStartDate,omitempty"` + ScheduleEndDate time.Time `json:"scheduleEndDate,omitempty"` + ServiceDetail ServiceDetail `json:"serviceDetail"` + DaysRun []string `json:"daysRun,omitempty"` + Stops []Stop `json:"stops,omitempty"` } // Contains service detail booleans