summaryrefslogtreecommitdiff
path: root/Biz/Dragons.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Biz/Dragons.hs')
-rw-r--r--Biz/Dragons.hs14
1 files changed, 8 insertions, 6 deletions
diff --git a/Biz/Dragons.hs b/Biz/Dragons.hs
index 0a3583d..7307f69 100644
--- a/Biz/Dragons.hs
+++ b/Biz/Dragons.hs
@@ -540,9 +540,9 @@ data Keep = Keep
$(deriveSafeCopy 0 'base ''Keep)
createUser :: User -> Acid.Update Keep User
-createUser u = do
+createUser User {..} = do
keep <- get
- let newUser = u {userId = nextUserId keep} :: User
+ let newUser = User {userId = nextUserId keep, ..}
put
<| keep
{ users = IxSet.insert newUser (users keep),
@@ -644,9 +644,10 @@ upsertGitHubUser keep tok ghUser =
|> GetUserByGitHubId
|> Acid.query keep
+> \case
- Just user ->
+ Just User {..} ->
-- if we already know this user, we need to refresh the token
- UpdateUser user {userGitHubToken = Encoding.decodeUtf8 tok}
+ User {userGitHubToken = Encoding.decodeUtf8 tok, ..}
+ |> UpdateUser
|> Acid.update keep
Nothing ->
CreateUser
@@ -1036,8 +1037,9 @@ htmlApp jwtCfg cooks kp cfg oAuthArgs =
guardAuth >=> UserAccount .> App.Html .> pure,
postAccount = \a subscription ->
guardAuth a
- +> \user ->
- UpdateUser user {userSubscription = subscription}
+ +> \User {..} ->
+ User {userSubscription = subscription, ..}
+ |> UpdateUser
|> Acid.update' kp
+> UserAccount
.> App.Html