blob: bc99ea5c3d583c4a5a5aaf2b128369a9180df18e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
{-# LANGUAGE OverloadedStrings #-}
module Controller.User
( getUsers
, whoAmI
, getIncome
) where
import Web.Scotty
import Control.Monad.IO.Class (liftIO)
import qualified Data.Aeson.Types as Json
import qualified Secure
import Json (jsonObject)
import Model.Database
import qualified Model.User as U
getUsers :: ActionM ()
getUsers =
Secure.loggedAction (\_ -> do
(liftIO $ map U.getJsonUser <$> runDb U.getUsers) >>= json
)
whoAmI :: ActionM ()
whoAmI =
Secure.loggedAction (\user -> do
json (U.getJsonUser user)
)
getIncome :: ActionM ()
getIncome =
Secure.loggedAction (\_ -> do
jsonObject []
)
|