let the function get the time itself
This commit is contained in:
parent
573d2af0df
commit
5280255ddc
2 changed files with 18 additions and 18 deletions
|
@ -184,9 +184,8 @@ userList muid ref = do
|
|||
productNew :: Maybe Int -> ProductSubmit -> MateHandler Int
|
||||
productNew (Just _) bevsub = do
|
||||
conn <- rsConnection <$> ask
|
||||
now <- liftIO $ getCurrentTime
|
||||
bevid <- insertProduct bevsub conn
|
||||
void $ insertNewEmptyAmount bevid now bevsub conn
|
||||
void $ insertNewEmptyAmount bevid bevsub conn
|
||||
return bevid
|
||||
productNew Nothing _ =
|
||||
throwError $ err403
|
||||
|
|
|
@ -56,12 +56,13 @@ amountTable = table "amount" (
|
|||
|
||||
insertNewEmptyAmount
|
||||
:: Int -- | the associated product id
|
||||
-> UTCTime -- | current time
|
||||
-> ProductSubmit -- | submitted product data
|
||||
-> PGS.Connection
|
||||
-> MateHandler Int
|
||||
insertNewEmptyAmount bevid now (ProductSubmit _ price _ _ _ _ _ _ _) conn =
|
||||
fmap head $ liftIO $ runInsert_ conn $ Insert
|
||||
insertNewEmptyAmount bevid (ProductSubmit _ price _ _ _ _ _ _ _) conn =
|
||||
liftIO $ do
|
||||
now <- getCurrentTime
|
||||
fmap head $ runInsert_ conn $ Insert
|
||||
{ iTable = amountTable
|
||||
, iRows =
|
||||
[
|
||||
|
|
Loading…
Reference in a new issue