summaryrefslogtreecommitdiff
path: root/Handler/Types.hs
blob: 2fc45a3ef9cd3d3efe535d1688a71f2cecabcc2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
module Handler.Types where

import Import

import qualified Data.Set as Set

getTypesR :: Handler Value
getTypesR = returnJson <=< runDB $ do
  Set.fromList . map (kindType . entityVal) <$> selectList [] []

getTypeR :: Handler Value
getTypeR = do
  kind <- maybe (invalidArgs ["kind"]) return =<< lookupGetParam "kind"
  returnJson <=< runDB $ kindType . entityVal <$> getBy404 (UniqueKind $ normalizeKind kind)