Move the book to have an id as well

This commit is contained in:
2018-08-07 22:27:05 +03:00
parent 881c53493f
commit 5dac8374fd
3 changed files with 12 additions and 11 deletions

View File

@ -49,6 +49,6 @@ listBooksHandler :: AuthResult SafeUser -> AppM [JsonBook]
listBooksHandler = requireLoggedIn $ \user -> do
runDB (usersBooks (view (field @"username") user) >>= mapM augment)
where
augment Book{..} = do
channels <- fmap (\Channel{..} -> JsonChannel{..}) <$> booksChannels contentHash
augment Book{identifier=bookId,..} = do
channels <- fmap (\Channel{..} -> JsonChannel{..}) <$> booksChannels bookId
pure JsonBook{..}