This commit is contained in:
nek0 2019-09-06 21:44:47 +02:00
parent 15e05b9075
commit 762506c644
3 changed files with 20 additions and 9 deletions

View File

@ -63,7 +63,7 @@ userUpdate (Just aid) id uds =
userList :: Maybe Int -> Maybe Refine -> MateHandler [User]
userList muid ref = do
conn <- rsConnection <$> ask
userSelect conn ref
userSelect ref conn
userRecharge :: Maybe Int -> UserRecharge -> MateHandler ()
userRecharge (Just auid) (UserRecharge amount) =

View File

@ -84,10 +84,10 @@ userTable = table "user" (
)
userSelect
:: PGS.Connection
-> Maybe Refine
:: Maybe Refine
-> PGS.Connection
-> MateHandler [User]
userSelect conn ref = do
userSelect ref conn = do
today <- utctDay <$> (liftIO $ getCurrentTime)
users <- liftIO $ runSelect conn (case ref of
Nothing -> keepWhen (\(_, _, _, ts, _, _, _, _, _) ->
@ -116,10 +116,10 @@ userSelect conn ref = do
users
userDetailsSelect
:: PGS.Connection
-> Int
:: Int
-> PGS.Connection
-> MateHandler UserDetails
userDetailsSelect conn id = do
userDetailsSelect id conn = do
today <- utctDay <$> (liftIO $ getCurrentTime)
users <- liftIO $ runSelect conn (
keepWhen (\(uid, _, _, _, _, _, _, _, _) ->

View File

@ -84,8 +84,7 @@ instance FromJSON UserDetailsSubmit
data UserRecharge = UserRecharge
{ userRechargeId :: Int
, userRechargeAmount :: Int
{ userRechargeAmount :: Int
}
deriving (Generic, Show)
@ -93,3 +92,15 @@ instance ToJSON UserRecharge where
toEncoding = genericToEncoding defaultOptions
instance FromJSON UserRecharge
data UserTransfer = UserTransfer
{ userTransferTarget :: Int
, userTransferAmount :: Int
}
deriving (Generic, Show)
instance ToJSON UserTransfer where
toEncoding = genericToEncoding defaultOptions
instance FromJSON UserTransfer