diff options
Diffstat (limited to 'src/BlogDB.hs')
-rw-r--r-- | src/BlogDB.hs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/BlogDB.hs b/src/BlogDB.hs index 52e4e80c397a..bc9c24393302 100644 --- a/src/BlogDB.hs +++ b/src/BlogDB.hs @@ -130,9 +130,15 @@ insertEntry e = updateEntry :: Entry -> Update Blog Entry updateEntry e = do b@Blog{..} <- get - put $ b { blogEntries = IxSet.updateIx (entryId e) e blogEntries} + put $ b { blogEntries = IxSet.updateIx (entryId e) e blogEntries } return e +deleteEntry :: EntryId -> Update Blog EntryId +deleteEntry entry = + do b@Blog{..} <- get + put $ b { blogEntries = IxSet.deleteIx entry blogEntries } + return entry + getEntry :: EntryId -> Query Blog (Maybe Entry) getEntry eId = do Blog{..} <- ask @@ -187,6 +193,7 @@ hashString = B64.encode . SHA.hash . B.pack $(makeAcidic ''Blog [ 'insertEntry , 'updateEntry + , 'deleteEntry , 'getEntry , 'latestEntries , 'addSession |