diff options
Diffstat (limited to 'Handler/Types.hs')
-rw-r--r-- | Handler/Types.hs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Handler/Types.hs b/Handler/Types.hs new file mode 100644 index 0000000..04055ad --- /dev/null +++ b/Handler/Types.hs | |||
@@ -0,0 +1,15 @@ | |||
1 | module Handler.Types where | ||
2 | |||
3 | import Import | ||
4 | |||
5 | import Data.Set (Set) | ||
6 | import qualified Data.Set as Set | ||
7 | |||
8 | getTypesR :: Handler Value | ||
9 | getTypesR = returnJson <=< runDB $ do | ||
10 | Set.fromList . map (kindType . entityVal) <$> selectList [] [] | ||
11 | |||
12 | getTypeR :: Handler Value | ||
13 | getTypeR = do | ||
14 | kind <- maybe (invalidArgs ["kind"]) return =<< lookupGetParam "kind" | ||
15 | returnJson <=< runDB $ kindType . entityVal <$> getBy404 (UniqueKind $ normalizeKind kind) | ||