From 7eb7b7ea0a08704533f6bff4325569c13b2ce62b Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Fri, 28 Jun 2024 15:05:31 +0100 Subject: [PATCH] Add upstream stations types --- pkg/database/station.go | 64 +++--------------------- pkg/upstreamApi/knowledgebaseStations.go | 13 +++++ 2 files changed, 19 insertions(+), 58 deletions(-) create mode 100644 pkg/upstreamApi/knowledgebaseStations.go diff --git a/pkg/database/station.go b/pkg/database/station.go index b8dad2f..0f0657b 100644 --- a/pkg/database/station.go +++ b/pkg/database/station.go @@ -2,19 +2,12 @@ package database // Station Information type Station struct { - CRS string `json:"3alpha"` - TIPLOC string `json:"tiploc"` - STANOX string `json:"stanox"` - Name string `json:"name"` - Location Location `json:"location"` - Operator string `json:"operator"` - Facilities Facilities `json:"facilities,omitempty"` -} - -// Location Details -type Location struct { - Geo GeoJson `json:"geo,omitempty"` - Address Address `json:"address,omitempty"` + CRS string `json:"3ALPHA"` + TIPLOC string `json:"TIPLOC"` + STANOX string `json:"STANOX"` + NLCDESC string `json:"NLCDESC"` + Location GeoJson `json:"location"` + Operator string `json:"operator"` } // GeoJson Coordinates = [long, lat] @@ -22,48 +15,3 @@ type GeoJson struct { Type string `json:"type"` Coordinates []float64 `json:"coordinates"` } - -// Street address in five line format -type Address struct { - Line1 string `json:"line1,omitempty"` - Line2 string `json:"line2,omitempty"` - Line3 string `json:"line3,omitempty"` - Line4 string `json:"line4,omitempty"` - Line5 string `json:"line5,omitempty"` -} - -// Station Facilities -type Facilities struct { - Staff bool - Cctv bool - Helppoint bool - Cis bool - Tvm bool - Seating bool - WaitingRoom bool - Buffet bool - Toilets bool - BabyChange bool - Telephones bool - InductionLoop bool - NKSToilets bool - Gateline bool - Cycle Cycle - CarPark CarPark -} - -// Station Cycle Facilities -type Cycle struct { - CycleSpaces int64 `json:"cycleSpaces"` - AccessibleCycleSpaces int64 `json:"accessibleCycleSpaces"` - SpaceTypes []string `json:"spaceTypes,omitempty"` - Sheltered bool `json:"sheltered,omitempty"` - Cctv bool `json:"cctv,omitempty"` -} - -// Station Carpark Facilities -type CarPark struct { - Spaces int64 `json:"spaces"` - AccessibleSpaces int64 `json:"accessibleSpaces"` - Cctv bool `json:"cctv,omitempty"` -} diff --git a/pkg/upstreamApi/knowledgebaseStations.go b/pkg/upstreamApi/knowledgebaseStations.go new file mode 100644 index 0000000..eb1ab7b --- /dev/null +++ b/pkg/upstreamApi/knowledgebaseStations.go @@ -0,0 +1,13 @@ +package upstreamApi + +type StationList struct { + Stations []Station `xml:"Station"` +} + +type Station struct { + CrsCode string `xml:"CrsCode"` + Name string `xml:"Name"` + Longitude float64 `xml:"Longitude"` + Latitude float64 `xml:"Latitude"` + StationOperator string `xml:"StationOperator"` +}