[]Route{
{"POST", []gin.HandlerFunc{Signup}, "/signup"},
{"POST", []gin.HandlerFunc{Signin}, "/signin"},
+ {"POST", []gin.HandlerFunc{PasswordReset}, "/passwordreset"},
+ {"POST", []gin.HandlerFunc{ChangePassword}, "/changepassword"},
+ {"POST", []gin.HandlerFunc{ConfirmEmail}, "/confirmemail"},
},
},
{
[]Route{
{"GET", []gin.HandlerFunc{GetMarketConfig}, "/:name"},
{"POST", []gin.HandlerFunc{UpdateMarketConfig}, "/:name/update"},
+ {"GET", []gin.HandlerFunc{TestMarketCredentials}, "/:name/test-credentials"},
+ {"GET", []gin.HandlerFunc{GetPortfolio}, "/:name/portfolio"},
+ },
+ },
+ {
+ "/user",
+ []Middleware{JwtAuth, UserConfirmed, OtpAuth},
+ []Route{
+ {"GET", []gin.HandlerFunc{UserAccount}, "/account"},
+ },
+ },
+ {
+ "/admin",
+ []Middleware{JwtAuth, UserConfirmed, UserIsAdmin, OtpAuth},
+ []Route{
+ {"GET", []gin.HandlerFunc{AdminGetAllPortfolios}, "/portfolios"},
},
},
}
RunQuery(query, c)
}
+func TestMarketCredentials(c *gin.Context) {
+ query := &TestMarketCredentialsQuery{}
+
+ query.In.User = GetUser(c)
+ query.In.Market = c.Param("name")
+
+ RunQuery(query, c)
+}
+
+func GetPortfolio(c *gin.Context) {
+ query := &GetPortfolioQuery{}
+
+ query.In.User = GetUser(c)
+ query.In.Market = c.Param("name")
+
+ RunQuery(query, c)
+}
+
func UpdateMarketConfig(c *gin.Context) {
query := &UpdateMarketConfigQuery{}
RunQuery(query, c)
}
+
+func PasswordReset(c *gin.Context) {
+ query := &PasswordResetQuery{}
+
+ query.In.Email = c.PostForm("email")
+
+ RunQuery(query, c)
+}
+
+func ChangePassword(c *gin.Context) {
+ query := &ChangePasswordQuery{}
+
+ query.In.Token = c.PostForm("token")
+ query.In.Password = c.PostForm("password")
+
+ RunQuery(query, c)
+}
+
+func ConfirmEmail(c *gin.Context) {
+ query := &ConfirmEmailQuery{}
+
+ query.In.Token = c.PostForm("token")
+
+ RunQuery(query, c)
+}
+
+func UserAccount(c *gin.Context) {
+ query := &UserAccountQuery{}
+
+ query.In.User = GetUser(c)
+
+ RunQuery(query, c)
+}
+
+func AdminGetAllPortfolios(c *gin.Context) {
+ query := &GetAllPortfoliosQuery{}
+
+ query.In.Market = "poloniex"
+
+ RunQuery(query, c)
+}