2019-09-08 00:37:50 +00:00
|
|
|
{-# LANGUAGE DataKinds #-}
|
|
|
|
{-# LANGUAGE TypeOperators #-}
|
|
|
|
{-# LANGUAGE DeriveGeneric #-}
|
|
|
|
{-# LANGUAGE FlexibleInstances #-}
|
|
|
|
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
|
|
|
|
{-# LANGUAGE MultiParamTypeClasses #-}
|
|
|
|
{-# LANGUAGE OverloadedStrings #-}
|
|
|
|
{-# LANGUAGE RankNTypes #-}
|
|
|
|
{-# LANGUAGE ScopedTypeVariables #-}
|
2019-09-17 19:29:56 +00:00
|
|
|
{-# LANGUAGE PackageImports #-}
|
2019-09-08 00:37:50 +00:00
|
|
|
|
|
|
|
module API where
|
|
|
|
|
|
|
|
import Servant.API
|
2019-09-16 07:44:46 +00:00
|
|
|
import Servant.Links
|
2019-09-08 00:37:50 +00:00
|
|
|
import Servant.RawM
|
|
|
|
import Servant.HTML.Blaze
|
|
|
|
|
2019-09-16 07:44:46 +00:00
|
|
|
import Data.Proxy
|
|
|
|
|
2019-09-17 19:29:56 +00:00
|
|
|
-- imports from "mateamt"
|
|
|
|
|
|
|
|
import qualified "mateamt" Types as MT
|
|
|
|
|
2019-09-08 00:37:50 +00:00
|
|
|
-- internal imports
|
|
|
|
|
|
|
|
import Types
|
|
|
|
|
|
|
|
type UserAPI =
|
2019-09-11 04:27:54 +00:00
|
|
|
Get '[HTML] UserSelectPage
|
|
|
|
:<|> "user" :> Capture "id" Int :> Get '[HTML] UserOverviewPage
|
2019-09-17 19:29:56 +00:00
|
|
|
:<|> "user" :> "create" :> Get '[HTML] UserNewPage
|
|
|
|
:<|> "user" :> "create" :> ReqBody '[FormUrlEncoded] MT.UserSubmit :> Post '[HTML] UserSelectPage
|
2019-09-11 04:27:54 +00:00
|
|
|
:<|> "auth" :> Get '[HTML] AuthPage
|
2019-09-08 10:48:57 +00:00
|
|
|
|
2019-09-16 07:44:46 +00:00
|
|
|
|
|
|
|
( userSelectLink :<|>
|
|
|
|
userOverviewLink :<|>
|
2019-09-17 19:29:56 +00:00
|
|
|
userNewLink :<|>
|
|
|
|
userNewPostLink :<|>
|
2019-09-16 07:44:46 +00:00
|
|
|
authLink
|
|
|
|
) = allLinks (Proxy :: Proxy UserAPI)
|