This commit is contained in:
nek0 2019-09-09 13:17:43 +02:00
parent fa5e0c8cb2
commit cd1e457bfb
3 changed files with 6 additions and 3 deletions

View file

@ -7,6 +7,8 @@ import Control.Monad (void)
import Control.Monad.Reader (ask)
import Data.Maybe (fromMaybe)
-- internal imports
import Types
@ -56,7 +58,7 @@ productStockUpdate Nothing _ =
{ errBody = "No Authentication present."
}
productList :: Maybe ProductRefine :> MateHandler [ProductOverview]
productList :: Maybe ProductRefine -> MateHandler [ProductOverview]
productList mrefine = do
conn <- rsConnection <$> ask
productOverviewSelect (fromMaybe AvailableProducts mrefine) conn

View file

@ -96,7 +96,7 @@ userTransfer (Just auid) (UserTransfer target amount) =
user <- userDetailsSelect auid conn
if amount < userDetailsBalance user
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)
then do
void $ addToUserBalance auid (-amount) conn

View file

@ -98,7 +98,8 @@ productSelect conn = do
productOverviewSelect
:: PGS.Connection
:: ProductRefine
-> PGS.Connection
-> MateHandler [ProductOverview]
productOverviewSelect conn = do
prods <- liftIO $ runSelect conn