about summary refs log tree commit diff
path: root/src/Invitations.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Invitations.hs')
-rw-r--r--src/Invitations.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/Invitations.hs b/src/Invitations.hs
index 62038bb03646..0c700470f3e2 100644
--- a/src/Invitations.hs
+++ b/src/Invitations.hs
@@ -12,3 +12,10 @@ create :: FilePath -> T.InvitationSecret -> T.Email -> T.Role -> IO ()
 create dbFile secret email role = withConnection dbFile $ \conn -> do
   execute conn "INSERT INTO Invitations (email,role,secret) VALUES (?,?,?)"
     (email, role, secret)
+
+get :: FilePath -> T.Email -> IO (Maybe T.Invitation)
+get dbFile email = withConnection dbFile $ \conn -> do
+  res <- query conn "SELECT email,role,secret FROM Invitations WHERE email = ?" (Only email)
+  case res of
+    [x] -> pure (Just x)
+    _ -> pure Nothing