foo
This commit is contained in:
parent
fa5e0c8cb2
commit
cd1e457bfb
3 changed files with 6 additions and 3 deletions
|
@ -7,6 +7,8 @@ import Control.Monad (void)
|
||||||
|
|
||||||
import Control.Monad.Reader (ask)
|
import Control.Monad.Reader (ask)
|
||||||
|
|
||||||
|
import Data.Maybe (fromMaybe)
|
||||||
|
|
||||||
-- internal imports
|
-- internal imports
|
||||||
|
|
||||||
import Types
|
import Types
|
||||||
|
@ -56,7 +58,7 @@ productStockUpdate Nothing _ =
|
||||||
{ errBody = "No Authentication present."
|
{ errBody = "No Authentication present."
|
||||||
}
|
}
|
||||||
|
|
||||||
productList :: Maybe ProductRefine :> MateHandler [ProductOverview]
|
productList :: Maybe ProductRefine -> MateHandler [ProductOverview]
|
||||||
productList mrefine = do
|
productList mrefine = do
|
||||||
conn <- rsConnection <$> ask
|
conn <- rsConnection <$> ask
|
||||||
productOverviewSelect (fromMaybe AvailableProducts mrefine) conn
|
productOverviewSelect (fromMaybe AvailableProducts mrefine) conn
|
||||||
|
|
|
@ -96,7 +96,7 @@ userTransfer (Just auid) (UserTransfer target amount) =
|
||||||
user <- userDetailsSelect auid conn
|
user <- userDetailsSelect auid conn
|
||||||
if amount < userDetailsBalance user
|
if amount < userDetailsBalance user
|
||||||
then do
|
then do
|
||||||
mtarget <- filter (\u -> userSummaryId u == target) <$> userSelect (Just All) conn
|
mtarget <- filter (\u -> userSummaryId u == target) <$> userSelect (Just AllUsers) conn
|
||||||
if not (null mtarget)
|
if not (null mtarget)
|
||||||
then do
|
then do
|
||||||
void $ addToUserBalance auid (-amount) conn
|
void $ addToUserBalance auid (-amount) conn
|
||||||
|
|
|
@ -98,7 +98,8 @@ productSelect conn = do
|
||||||
|
|
||||||
|
|
||||||
productOverviewSelect
|
productOverviewSelect
|
||||||
:: PGS.Connection
|
:: ProductRefine
|
||||||
|
-> PGS.Connection
|
||||||
-> MateHandler [ProductOverview]
|
-> MateHandler [ProductOverview]
|
||||||
productOverviewSelect conn = do
|
productOverviewSelect conn = do
|
||||||
prods <- liftIO $ runSelect conn
|
prods <- liftIO $ runSelect conn
|
||||||
|
|
Loading…
Reference in a new issue