add recharge routine

This commit is contained in:
nek0 2019-08-14 18:03:51 +02:00
parent 745780486b
commit aab443cc92
3 changed files with 15 additions and 0 deletions

View File

@ -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

View File

@ -75,6 +75,7 @@ app initState =
userGet :<|>
userUpdate :<|>
userList :<|>
userRecharge :<|>
productNew :<|>
productOverview :<|>

View File

@ -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