diff options
author | Joris | 2016-11-13 00:49:32 +0100 |
---|---|---|
committer | Joris | 2016-11-13 00:49:32 +0100 |
commit | 86a96decdb8892b10c5314eb916ef15a64204450 (patch) | |
tree | 6f41742d0466f77948680964188144fbff036902 /src/server/Model/User.hs | |
parent | bf6a0a0b32a7efb88f75c2e89b84d6907aeb10bc (diff) |
Send weekly activity at start of week about previous week
Diffstat (limited to 'src/server/Model/User.hs')
-rw-r--r-- | src/server/Model/User.hs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/server/Model/User.hs b/src/server/Model/User.hs index 2b52d03..696ef4f 100644 --- a/src/server/Model/User.hs +++ b/src/server/Model/User.hs @@ -1,6 +1,7 @@ module Model.User ( getUsers , getUser + , findUser , getJsonUser , createUser , deleteUser @@ -8,6 +9,7 @@ module Model.User import Data.Text (Text) import Data.Time.Clock (getCurrentTime) +import Data.List (find) import Control.Monad.IO.Class (liftIO) @@ -22,6 +24,9 @@ getUsers = selectList [] [Desc UserCreation] getUser :: Text -> Persist (Maybe (Entity User)) getUser email = selectFirst [UserEmail ==. email] [] +findUser :: UserId -> [Entity User] -> Maybe User +findUser i = fmap entityVal . find ((==) i . entityKey) + getJsonUser :: Entity User -> Json.User getJsonUser userEntity = let user = entityVal userEntity |