From 86a96decdb8892b10c5314eb916ef15a64204450 Mon Sep 17 00:00:00 2001 From: Joris Date: Sun, 13 Nov 2016 00:49:32 +0100 Subject: Send weekly activity at start of week about previous week --- src/server/Model/User.hs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/server/Model/User.hs') 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 -- cgit v1.2.3