This commit is contained in:
2018-08-06 00:09:41 +03:00
parent c5d3f8d2e7
commit 881c53493f
2 changed files with 48 additions and 16 deletions

View File

@ -32,12 +32,15 @@ data JsonBook = JsonBook { contentType :: Text
, channels :: [JsonChannel] }
deriving (Generic, Show)
instance ToJSON JsonBook
instance FromJSON JsonBook
type API = Auth '[SA.BasicAuth, SA.JWT] SafeUser :> BaseAPI
type BaseAPI = "books" :> Get '[JSON] [JsonBook]
-- :<|> "books" :> ReqBody '[JSON] JsonBook :> PUT JsonBook
-- :<|> "books" :> Param "book_id" BookID :> ReqBody '[JSON] JsonBook :> PUT JsonBook
handler :: ServerT API AppM
handler user = listBooksHandler user