summaryrefslogtreecommitdiff
path: root/Handler/OpenItem.hs
blob: 468c6ec1fe7c6f90f6c20bba1b723f0e799ac4cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
module Handler.OpenItem where

import Import

postOpenItemR :: ItemId -> Handler TypedContent
postOpenItemR itemId = do
  today <- utctDay <$> liftIO getCurrentTime
  result <- fmap (Entity itemId) . runDB $ updateGet itemId [ ItemOpened =. Just today
                                                            ]
  selectRep $ do
    provideJson result
    provideRep (redirect $ InventoryListingR :#: itemId :: Handler Html)