@@ -309,8 +309,7 @@ getAllUsers :: StaticPQ [User]
309getAllUsers = runQuery getAllUsersQ >>= getRows
309getAllUsers = runQuery getAllUsersQ >>= getRows
311publishPost :: UserId -> PostCreation -> StaticPQ PostId
311publishPost :: UserId -> PostCreation -> StaticPQ PostId
312−-- publishPost uId pc = transactionally_ $ do
312+publishPost uId pc = commitedTransactionallyUpdate $ do
313−publishPost uId pc = do
314 pId' <- manipulateParams createPostRowQ (uId, postCreationTags pc) >>= firstRow
313 pId' <- manipulateParams createPostRowQ (uId, postCreationTags pc) >>= firstRow
315 case pId' of
314 case pId' of
316 (Just (Only pId)) -> do
315 (Just (Only pId)) -> do
@@ -319,15 +318,13 @@ publishPost uId pc = do
319 _ -> lift $ S.throwError S.err404
318 _ -> lift $ S.throwError S.err404
321createNewChannel :: UserId -> NamedChannelCreationRequest -> StaticPQ (Maybe NamedChannelId)
320createNewChannel :: UserId -> NamedChannelCreationRequest -> StaticPQ (Maybe NamedChannelId)
322−-- createNewChannel uId req = transactionally_ $ do
321+createNewChannel uId req = commitedTransactionallyUpdate $ do
323−createNewChannel uId req = do
324 uIds <- verifiedUsers . toList $ namedChannelCreationRequestPeopleIds req
322 uIds <- verifiedUsers . toList $ namedChannelCreationRequestPeopleIds req
325 cId <- manipulateParams createNamedChannelQ (addUserToChannelCreate uId (req {namedChannelCreationRequestPeopleIds = fromList uIds})) >>= firstRow
323 cId <- manipulateParams createNamedChannelQ (addUserToChannelCreate uId (req {namedChannelCreationRequestPeopleIds = fromList uIds})) >>= firstRow
326 return $ fmap fromOnly cId
324 return $ fmap fromOnly cId
328updateChannel :: UserId -> NamedChannel UserId -> StaticPQ ()
326updateChannel :: UserId -> NamedChannel UserId -> StaticPQ ()
329−-- updateChannel uId req = transactionally_ $ do
327+updateChannel uId req = commitedTransactionallyUpdate $ do
330−updateChannel uId req = do
331 uIds <- fmap fromList . verifiedUsers . toList $ namedChannelPeopleIds req
328 uIds <- fmap fromList . verifiedUsers . toList $ namedChannelPeopleIds req
332 _ <- getChannelForUser uId $ namedChannelId req
329 _ <- getChannelForUser uId $ namedChannelId req
333 _ <- manipulateParams updateNamedChannelQ $ addUserToChannelUpdate uId (req {namedChannelPeopleIds = uIds})
330 _ <- manipulateParams updateNamedChannelQ $ addUserToChannelUpdate uId (req {namedChannelPeopleIds = uIds})
@@ -350,8 +347,7 @@ getAllChannels uId = fmap (map removeUserFromChannel) $
350 runQueryParams getAllChannelsForUserQ (Only uId) >>= getRows
347 runQueryParams getAllChannelsForUserQ (Only uId) >>= getRows
352deleteNamedChannel :: UserId -> NamedChannelId -> StaticPQ ()
349deleteNamedChannel :: UserId -> NamedChannelId -> StaticPQ ()
353−-- deleteNamedChannel uId cId = transactionally_ $ do
350+deleteNamedChannel uId cId = commitedTransactionallyUpdate $ do
354−deleteNamedChannel uId cId = do
355 _ <- getChannelForUser uId cId
351 _ <- getChannelForUser uId cId
356 _ <- manipulateParams deleteNamedChannelQ (Only cId)
352 _ <- manipulateParams deleteNamedChannelQ (Only cId)
357 return ()
353 return ()