add logs to deleteContact

This commit is contained in:
JRoberts
2022-05-07 19:33:47 +04:00
parent b1024be74d
commit 2c61358cb9
2 changed files with 7 additions and 3 deletions

View File

@@ -2137,9 +2137,9 @@ withStore ::
m a
withStore action =
asks chatStore
>>= runExceptT . action
-- >>= runExceptT . action
-- use this line instead of above to log query errors
-- >>= (\st -> runExceptT $ action st `E.catch` \(e :: E.SomeException) -> liftIO (print e) >> E.throwIO e)
>>= (\st -> runExceptT $ action st `E.catch` \(e :: E.SomeException) -> liftIO (print e) >> E.throwIO e)
>>= liftEither . first ChatErrorStore
chatCommandP :: Parser ChatCommand

View File

@@ -428,8 +428,10 @@ getContactGroupNames st userId Contact {contactId} =
(userId, contactId)
deleteContact :: MonadUnliftIO m => SQLiteStore -> UserId -> Contact -> m ()
deleteContact st userId Contact {contactId, localDisplayName} =
deleteContact st userId Contact {contactId, localDisplayName} = do
liftIO $ putStrLn "in deleteContact, liftIO . withTransaction st $ \\db -> do"
liftIO . withTransaction st $ \db -> do
liftIO $ putStrLn "DB.execute DELETE FROM connections WHERE connection_id IN ..."
DB.execute
db
[sql|
@@ -441,7 +443,9 @@ deleteContact st userId Contact {contactId, localDisplayName} =
)
|]
(userId, contactId)
liftIO $ putStrLn "DB.execute db \"DELETE FROM contacts WHERE user_id = ? AND contact_id = ?\" (userId, contactId)"
DB.execute db "DELETE FROM contacts WHERE user_id = ? AND contact_id = ?" (userId, contactId)
liftIO $ putStrLn "DB.execute db \"DELETE FROM display_names WHERE user_id = ? AND local_display_name = ?\" (userId, localDisplayName)"
DB.execute db "DELETE FROM display_names WHERE user_id = ? AND local_display_name = ?" (userId, localDisplayName)
updateUserProfile :: StoreMonad m => SQLiteStore -> User -> Profile -> m ()