aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorS7evinK <tfaelligen@gmail.com>2020-10-19 10:38:10 +0200
committerGitHub <noreply@github.com>2020-10-19 09:38:10 +0100
commit0974f6e2c055d8d06b5ea9c175252b22b2399fe2 (patch)
tree2e44a08a0c3ffef5225265325b49828c1093c0e7
parent640e8c50ec1b7ebb54c57a59bf1d6a7716c328cf (diff)
Fix internal http api (#1535)
Signed-off-by: Till Faelligen <tfaelligen@gmail.com>
-rw-r--r--userapi/inthttp/server.go17
1 files changed, 15 insertions, 2 deletions
diff --git a/userapi/inthttp/server.go b/userapi/inthttp/server.go
index e24aad3a..81e936e5 100644
--- a/userapi/inthttp/server.go
+++ b/userapi/inthttp/server.go
@@ -39,7 +39,7 @@ func AddRoutes(internalAPIMux *mux.Router, s api.UserInternalAPI) {
return util.JSONResponse{Code: http.StatusOK, JSON: &response}
}),
)
- internalAPIMux.Handle(PerformAccountCreationPath,
+ internalAPIMux.Handle(PerformPasswordUpdatePath,
httputil.MakeInternalAPI("performPasswordUpdate", func(req *http.Request) util.JSONResponse {
request := api.PerformPasswordUpdateRequest{}
response := api.PerformPasswordUpdateResponse{}
@@ -169,7 +169,7 @@ func AddRoutes(internalAPIMux *mux.Router, s api.UserInternalAPI) {
return util.JSONResponse{Code: http.StatusOK, JSON: &response}
}),
)
- internalAPIMux.Handle(QueryDeviceInfosPath,
+ internalAPIMux.Handle(QuerySearchProfilesPath,
httputil.MakeInternalAPI("querySearchProfiles", func(req *http.Request) util.JSONResponse {
request := api.QuerySearchProfilesRequest{}
response := api.QuerySearchProfilesResponse{}
@@ -182,4 +182,17 @@ func AddRoutes(internalAPIMux *mux.Router, s api.UserInternalAPI) {
return util.JSONResponse{Code: http.StatusOK, JSON: &response}
}),
)
+ internalAPIMux.Handle(InputAccountDataPath,
+ httputil.MakeInternalAPI("inputAccountDataPath", func(req *http.Request) util.JSONResponse {
+ request := api.InputAccountDataRequest{}
+ response := api.InputAccountDataResponse{}
+ if err := json.NewDecoder(req.Body).Decode(&request); err != nil {
+ return util.MessageResponse(http.StatusBadRequest, err.Error())
+ }
+ if err := s.InputAccountData(req.Context(), &request, &response); err != nil {
+ return util.ErrorResponse(err)
+ }
+ return util.JSONResponse{Code: http.StatusOK, JSON: &response}
+ }),
+ )
}