diff options
Diffstat (limited to 'Handler/OpenItem.hs')
-rw-r--r-- | Handler/OpenItem.hs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Handler/OpenItem.hs b/Handler/OpenItem.hs new file mode 100644 index 0000000..468c6ec --- /dev/null +++ b/Handler/OpenItem.hs | |||
@@ -0,0 +1,12 @@ | |||
1 | module Handler.OpenItem where | ||
2 | |||
3 | import Import | ||
4 | |||
5 | postOpenItemR :: ItemId -> Handler TypedContent | ||
6 | postOpenItemR itemId = do | ||
7 | today <- utctDay <$> liftIO getCurrentTime | ||
8 | result <- fmap (Entity itemId) . runDB $ updateGet itemId [ ItemOpened =. Just today | ||
9 | ] | ||
10 | selectRep $ do | ||
11 | provideJson result | ||
12 | provideRep (redirect $ InventoryListingR :#: itemId :: Handler Html) | ||