summaryrefslogtreecommitdiff
path: root/Handler/Types.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Handler/Types.hs')
-rw-r--r--Handler/Types.hs15
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 @@
1module Handler.Types where
2
3import Import
4
5import Data.Set (Set)
6import qualified Data.Set as Set
7
8getTypesR :: Handler Value
9getTypesR = returnJson <=< runDB $ do
10 Set.fromList . map (kindType . entityVal) <$> selectList [] []
11
12getTypeR :: Handler Value
13getTypeR = do
14 kind <- maybe (invalidArgs ["kind"]) return =<< lookupGetParam "kind"
15 returnJson <=< runDB $ kindType . entityVal <$> getBy404 (UniqueKind $ normalizeKind kind)