summaryrefslogtreecommitdiff
path: root/Handler/OpenItem.hs
blob: 3b1dfeb8bec22c0b014ecb3bb6ff41a7eb82342a (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 =. DateKnown today
                                                            ]
  selectRep $ do
    provideJson result
    provideRep (redirect $ InventoryListingR :#: itemId :: Handler Html)