From 4557157a4fe3ec608713e4faec7a91a2bf7d5cdf Mon Sep 17 00:00:00 2001 From: neko Date: Tue, 18 Aug 2015 23:58:33 +0200 Subject: [PATCH] added uniqueUser --- Handler/Profile.hs | 2 +- config/models | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Handler/Profile.hs b/Handler/Profile.hs index 3372248..35dd03c 100644 --- a/Handler/Profile.hs +++ b/Handler/Profile.hs @@ -52,7 +52,7 @@ getProfileR ownerId = do getUserR :: Text -> Handler Html getUserR ownerName = do - tempOwner <- runDB $ selectFirst [UserName ==. ownerName] [] + tempOwner <- runDB $ getBy $ UniqueUser ownerName case tempOwner of Just (Entity ownerId _) -> getProfileR ownerId diff --git a/config/models b/config/models index 2786cbf..2621798 100644 --- a/config/models +++ b/config/models @@ -22,6 +22,7 @@ User salted ByteString albums [AlbumId] admin Bool + UniqueUser name deriving Typeable Eq Show Activator token Text