diff options
author | stuebinm | 2024-04-24 21:52:45 +0200 |
---|---|---|
committer | stuebinm | 2024-04-24 21:52:45 +0200 |
commit | d4f4208fe66d3813b65312dac0bf895c4cdc53d6 (patch) | |
tree | 698592178936900ae76985f5e1b3cdf72123afb4 /lib/API.hs | |
parent | 607b9486a81ed6cb65d30227aeecea3412bd1ccd (diff) |
restructure: save a ticket's stop in the database
now mostly independent of the gtfs, but still no live-reloading of it.
Diffstat (limited to 'lib/API.hs')
-rw-r--r-- | lib/API.hs | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -30,7 +30,6 @@ import Servant.API (Accept, Capture, Get, JSON, Post, QueryParam, Raw, ReqBody, type (:<|>) (..)) import Servant.API.WebSocket (WebSocket) --- import Servant.GTFS.Realtime (Proto) import Servant.Swagger (HasSwagger (..)) import Web.Internal.FormUrlEncoded (Form) @@ -42,7 +41,9 @@ import qualified Data.ByteString.Lazy as LB import Data.HashMap.Strict.InsOrd (singleton) import Data.ProtoLens (Message, encodeMessage) import GHC.Generics (Generic) -import GTFS +import GTFS (Depth (Deep), GTFSFile (..), + StationID, Trip, TripId, + aesonOptions, swaggerOptions) import Network.HTTP.Media ((//)) import Persist import Prometheus @@ -62,8 +63,7 @@ instance ToSchema Value where & type_ ?~ SwaggerObject -- | The server's API (as it is actually intended). -type API = "stations" :> Get '[JSON] (Map StationID Station) - :<|> "timetable" :> Capture "Station Id" StationID :> QueryParam "day" Day :> Get '[JSON] (Map TripId (Trip Deep Deep)) +type API = "timetable" :> Capture "Station Id" StationID :> QueryParam "day" Day :> Get '[JSON] (Map TripId (Trip Deep Deep)) :<|> "timetable" :> "stops" :> Capture "Date" Day :> Get '[JSON] Value :<|> "trip" :> Capture "Trip Id" TripId :> Get '[JSON] (Trip Deep Deep) -- ingress API (put this behind BasicAuth?) |