From 781b1cb3dbf19a939973537d2db594f74391d694 Mon Sep 17 00:00:00 2001 From: nek0 Date: Mon, 18 Aug 2014 03:11:05 +0200 Subject: [PATCH] album now gets updated mith media --- Handler/Upload.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Handler/Upload.hs b/Handler/Upload.hs index 83617e4..0bb74a4 100644 --- a/Handler/Upload.hs +++ b/Handler/Upload.hs @@ -38,15 +38,19 @@ postUploadR = do case result of FormSuccess temp -> do path <- writeOnDrive (tempMediumFile temp) userId (tempMediumAlbum temp) + inAlbumId <- return $ tempMediumAlbum temp medium <- return $ Medium (tempMediumTitle temp) - path + ('/' : path) (tempMediumTime temp) (tempMediumOwner temp) (tempMediumDesc temp) (tempMediumTags temp) - (tempMediumAlbum temp) + inAlbumId mId <- runDB $ I.insert medium + inAlbum <- runDB $ getJust inAlbumId + newMediaList <- return $ mId : (albumContent inAlbum) + runDB $ update inAlbumId [AlbumContent =. newMediaList] setMessage "Image succesfully uploaded" redirect $ HomeR _ -> do