From 198290cf11d859aa7f10e9377db8b65646340bca Mon Sep 17 00:00:00 2001 From: stuebinm Date: Sun, 3 Jul 2022 22:41:46 +0200 Subject: barebones webform API & frontend --- lib/API.hs | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) (limited to 'lib/API.hs') diff --git a/lib/API.hs b/lib/API.hs index a04e131..f95132a 100644 --- a/lib/API.hs +++ b/lib/API.hs @@ -7,27 +7,29 @@ -- Haskell type. All other descriptions of the API are generated from this one. module API (API, CompleteAPI, GtfsRealtimeAPI, AdminAPI) where -import Data.Map (Map) -import Data.Proxy (Proxy (..)) -import Data.Swagger (Swagger) -import Data.Swagger.ParamSchema (ToParamSchema (..)) -import Data.Text (Text) -import Data.Time (Day, UTCTime) -import Data.UUID (UUID) -import Servant (Application, - FromHttpApiData (parseUrlPiece), - Server, err401, err404, type (:>)) -import Servant.API (Capture, Get, JSON, NoContent, Post, - QueryParam, ReqBody, - type (:<|>) ((:<|>))) -import Servant.API.WebSocket (WebSocket) -import Servant.GTFS.Realtime (Proto) -import Servant.Swagger (HasSwagger (..)) +import Data.Map (Map) +import Data.Proxy (Proxy (..)) +import Data.Swagger (Swagger) +import Data.Swagger.ParamSchema (ToParamSchema (..)) +import Data.Text (Text) +import Data.Time (Day, UTCTime) +import Data.UUID (UUID) +import Servant (Application, FormUrlEncoded, + FromHttpApiData (parseUrlPiece), + Server, err401, err404, type (:>)) +import Servant.API (Capture, Get, JSON, NoContent, + PlainText, Post, QueryParam, + ReqBody, type (:<|>) ((:<|>))) +import Servant.API.WebSocket (WebSocket) +import Servant.GTFS.Realtime (Proto) +import Servant.Swagger (HasSwagger (..)) +import Web.Internal.FormUrlEncoded (Form) import GTFS import GTFS.Realtime.FeedEntity -import GTFS.Realtime.FeedMessage (FeedMessage) +import GTFS.Realtime.FeedMessage (FeedMessage) import Persist +import Server.ControlRoom -- | The server's API (as it is actually intended). @@ -45,6 +47,7 @@ type API = "stations" :> Get '[JSON] (Map StationID Station) :<|> "gtfs" :> GtfsRealtimeAPI -- TODO: this should be behind auth / OpenID or something :<|> "admin" :> AdminAPI + :<|> "control" :> ControlRoomAPI -- | The API used for publishing gtfs realtime updates type GtfsRealtimeAPI = "servicealerts" :> Get '[Proto] FeedMessage -- cgit v1.2.3