Complete functions for channels
This commit is contained in:
parent
f7bc0d420c
commit
c05251525b
@ -51,8 +51,8 @@ booksChannels bookId = fromRels <$> query q
|
|||||||
|
|
||||||
attachChannel :: (MonadMask m, MonadIO m, MonadSelda m) => Username -> BookID -> Text -> m ()
|
attachChannel :: (MonadMask m, MonadIO m, MonadSelda m) => Username -> BookID -> Text -> m ()
|
||||||
attachChannel username bookId channel = do
|
attachChannel username bookId channel = do
|
||||||
-- XXX: test what happens if channel doesn't exist
|
mCh <- fromRels <$> query channelQ
|
||||||
[Channel{identifier}] <- fromRels <$> query channelQ
|
forM_ mCh $ \Channel{identifier} ->
|
||||||
whenM (null <$> query (attachQ identifier)) $
|
whenM (null <$> query (attachQ identifier)) $
|
||||||
void $ insertGen bookChannels [BookChannel identifier bookId]
|
void $ insertGen bookChannels [BookChannel identifier bookId]
|
||||||
where
|
where
|
||||||
|
Loading…
Reference in New Issue
Block a user