diff options
Diffstat (limited to 'lib/Server.hs')
-rw-r--r-- | lib/Server.hs | 41 |
1 files changed, 11 insertions, 30 deletions
diff --git a/lib/Server.hs b/lib/Server.hs index e84be7d..a5a5ff9 100644 --- a/lib/Server.hs +++ b/lib/Server.hs @@ -11,57 +11,38 @@ -- Implementation of the API. This module is the main point of the program. module Server (application) where -import Conduit (MonadTrans (lift), ResourceT) import Control.Monad (forever, void, when) import Control.Monad.Extra (maybeM, whenM) import Control.Monad.IO.Class (MonadIO (liftIO)) -import Control.Monad.Logger (NoLoggingT, logWarnN) +import Control.Monad.Logger (logWarnN) import Control.Monad.Reader (forM) -import Control.Monad.Trans.Maybe (MaybeT (..)) -import Data.Aeson (FromJSON (parseJSON), - ToJSON (toJSON), ToJSONKey, - genericParseJSON, genericToJSON) +import Control.Monad.Trans (lift) import qualified Data.Aeson as A import qualified Data.ByteString.Char8 as C8 import Data.Coerce (coerce) import Data.Functor ((<&>)) -import Data.Map (Map) import qualified Data.Map as M import Data.Pool (Pool) import Data.Proxy (Proxy (Proxy)) -import Data.Swagger hiding (delete, get) +import Data.Swagger (toSchema) import Data.Text (Text) import Data.Time (NominalDiffTime, UTCTime (utctDay), addUTCTime, - dayOfWeek, diffUTCTime, - getCurrentTime, nominalDay) -import Data.UUID (UUID) -import qualified Data.UUID as UUID -import qualified Data.UUID.V4 as UUID -import Data.Vector (Vector) + diffUTCTime, getCurrentTime, + nominalDay) import qualified Data.Vector as V import Database.Persist -import Database.Persist.Postgresql +import Database.Persist.Postgresql (SqlBackend, runMigration) import Fmt ((+|), (|+)) -import GHC.Generics (Generic) -import GTFS import qualified Network.WebSockets as WS -import Servant (Application, - FromHttpApiData (parseUrlPiece), - Server, err401, err404, serve, - throwError) -import Servant.API (Capture, FromHttpApiData, Get, - JSON, NoContent (..), Post, - ReqBody, type (:<|>) ((:<|>))) -import Servant.Docs (DocCapture (..), - DocQueryParam (..), - ParamKind (..), ToCapture (..), - ToParam (..)) -import Servant.Server (Handler, ServerT, hoistServer) +import Servant (Application, err401, err404, + serve, throwError) +import Servant.API (NoContent (..), (:<|>) (..)) +import Servant.Server (Handler, hoistServer) import Servant.Swagger (toSwagger) -import Web.PathPieces (PathPiece) import API +import GTFS import Persist import Server.GTFS_RT (gtfsRealtimeServer) import Server.Util (Service, ServiceM, runService) |