loss in backup

This commit is contained in:
nek0 2017-01-22 12:58:10 +01:00
parent 3d802eeaf2
commit a12de9e1b2

View file

@ -47,6 +47,7 @@ data BevStore = BevStore
{ bevStoreIdent :: Text { bevStoreIdent :: Text
, bevStorePrice :: Int , bevStorePrice :: Int
, bevStoreAmount :: Int , bevStoreAmount :: Int
, bevStoreLostAmount :: Int
, bevStoreMaxAmount :: Int , bevStoreMaxAmount :: Int
, bevStorePerCrate :: Maybe Int , bevStorePerCrate :: Maybe Int
, bevStoreAlertAmount :: Int , bevStoreAlertAmount :: Int
@ -56,11 +57,12 @@ data BevStore = BevStore
} }
instance ToJSON BevStore where instance ToJSON BevStore where
toJSON (BevStore ident price amount maxAmount perCrate alertAmount ml artNr ppc) = toJSON (BevStore ident price amount loss maxAmount perCrate alertAmount ml artNr ppc) =
object object
[ "name" .= ident [ "name" .= ident
, "price" .= price , "price" .= price
, "amount" .= amount , "amount" .= amount
, "lost_amount" .= loss
, "alertAt" .= alertAmount , "alertAt" .= alertAmount
, "max" .= maxAmount , "max" .= maxAmount
, "perCrate" .= perCrate , "perCrate" .= perCrate
@ -74,6 +76,7 @@ instance FromJSON BevStore where
<$> o .: "name" <$> o .: "name"
<*> o .: "price" <*> o .: "price"
<*> o .: "amount" <*> o .: "amount"
<*> o .: "lost_amount"
<*> o .: "max" <*> o .: "max"
<*> o .:? "perCrate" <*> o .:? "perCrate"
<*> o .: "alertAt" <*> o .: "alertAt"
@ -92,6 +95,7 @@ getInventoryJsonR = do
(beverageIdent bev) (beverageIdent bev)
(beveragePrice bev) (beveragePrice bev)
(beverageAmount bev) (beverageAmount bev)
(beverageCorrectedAmount bev)
(beverageMaxAmount bev) (beverageMaxAmount bev)
(beveragePerCrate bev) (beveragePerCrate bev)
(beverageAlertAmount bev) (beverageAlertAmount bev)
@ -138,6 +142,7 @@ insOrUpd bev = do
(bevStorePrice bev) (bevStorePrice bev)
(bevStoreAmount bev) (bevStoreAmount bev)
(bevStoreAlertAmount bev) (bevStoreAlertAmount bev)
(bevStoreLostAmount bev)
0 0
(bevStoreMl bev) (bevStoreMl bev)
Nothing Nothing
@ -150,6 +155,7 @@ insOrUpd bev = do
[ BeverageIdent =. bevStoreIdent bev [ BeverageIdent =. bevStoreIdent bev
, BeveragePrice =. bevStorePrice bev , BeveragePrice =. bevStorePrice bev
, BeverageAmount =. bevStoreAmount bev , BeverageAmount =. bevStoreAmount bev
, BeverageCorrectedAmount =. bevStoreLostAmount bev
, BeverageAlertAmount =. bevStoreAlertAmount bev , BeverageAlertAmount =. bevStoreAlertAmount bev
, BeverageMl =. bevStoreMl bev , BeverageMl =. bevStoreMl bev
, BeverageMaxAmount =. bevStoreMaxAmount bev , BeverageMaxAmount =. bevStoreMaxAmount bev