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 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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -98,7 +98,8 @@ productSelect conn = do
|
|||
|
||||
|
||||
productOverviewSelect
|
||||
:: PGS.Connection
|
||||
:: ProductRefine
|
||||
-> PGS.Connection
|
||||
-> MateHandler [ProductOverview]
|
||||
productOverviewSelect conn = do
|
||||
prods <- liftIO $ runSelect conn
|
||||
|
|
Loading…
Reference in a new issue