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 :: Maybe Int -> Maybe Refine -> MateHandler [User]
userList muid ref = do userList muid ref = do
conn <- rsConnection <$> ask conn <- rsConnection <$> ask
userSelect conn ref userSelect ref conn
userRecharge :: Maybe Int -> UserRecharge -> MateHandler () userRecharge :: Maybe Int -> UserRecharge -> MateHandler ()
userRecharge (Just auid) (UserRecharge amount) = userRecharge (Just auid) (UserRecharge amount) =

View file

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

View file

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