2020-07-24 20:00:29 +02:00
|
|
|
{-# LANGUAGE DataKinds #-}
|
|
|
|
{-# LANGUAGE OverloadedStrings #-}
|
2020-07-24 23:46:54 +02:00
|
|
|
{-# LANGUAGE LambdaCase #-}
|
|
|
|
{-# LANGUAGE TypeFamilies #-}
|
|
|
|
{-# LANGUAGE TypeOperators #-}
|
2020-07-24 20:00:29 +02:00
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
module API where
|
|
|
|
--------------------------------------------------------------------------------
|
2020-07-24 23:46:54 +02:00
|
|
|
import Data.Proxy
|
|
|
|
import Data.Text
|
|
|
|
import Database.Persist
|
|
|
|
import Servant.API
|
2020-07-24 20:00:29 +02:00
|
|
|
|
2020-07-24 23:46:54 +02:00
|
|
|
import qualified Types as T
|
2020-07-24 20:00:29 +02:00
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
2020-07-24 23:46:54 +02:00
|
|
|
type API = "user"
|
|
|
|
:> ReqBody '[JSON] T.User
|
|
|
|
:> Post '[JSON] (Maybe (Key T.User))
|
|
|
|
:<|> "user"
|
|
|
|
:> Capture "name" Text
|
|
|
|
:> Get '[JSON] (Maybe T.User)
|