add recharge routine
This commit is contained in:
parent
745780486b
commit
aab443cc92
3 changed files with 15 additions and 0 deletions
|
@ -34,6 +34,8 @@ type UserAPI =
|
|||
:> Capture "uid'" Int :> ReqBody '[JSON] UserDetailsSubmit :> Patch '[JSON] ()
|
||||
:<|> "user" :> "list" :> AuthProtect "header-auth"
|
||||
:> QueryParam "refine" Refine :> Get '[JSON] [User]
|
||||
:<|> "user" :> "recharge" :> AuthProtect "header-auth"
|
||||
:> ReqBody '[JSON] UserRecharge :> Post '[JSON] ()
|
||||
|
||||
:<|> "product" :> AuthProtect "header-auth" :> ReqBody '[JSON] ProductSubmit
|
||||
:> Post '[JSON] Int
|
||||
|
|
|
@ -75,6 +75,7 @@ app initState =
|
|||
userGet :<|>
|
||||
userUpdate :<|>
|
||||
userList :<|>
|
||||
userRecharge :<|>
|
||||
|
||||
productNew :<|>
|
||||
productOverview :<|>
|
||||
|
|
|
@ -81,3 +81,15 @@ instance ToJSON UserDetailsSubmit where
|
|||
toEncoding = genericToEncoding defaultOptions
|
||||
|
||||
instance FromJSON UserDetailsSubmit
|
||||
|
||||
|
||||
data UserRecharge = UserRecharge
|
||||
{ userRechargeId :: Int
|
||||
, userRechargeAmount :: Int
|
||||
}
|
||||
deriving (Generic, Show)
|
||||
|
||||
instance ToJSON UserRecharge where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
|
||||
instance FromJSON UserRecharge
|
||||
|
|
Loading…
Reference in a new issue