diff options
author | PiotrKozimor <37144818+PiotrKozimor@users.noreply.github.com> | 2022-04-08 11:18:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-08 10:18:27 +0100 |
commit | 63b7c3da463a23e25146107760720e08a8c96f0f (patch) | |
tree | fd908a5fdca96b5d5c7963f279dddeb5eb403a82 /userapi | |
parent | 7499147550110d24fa3a376bd811d9dd38971629 (diff) |
Handle QueryAccountAvailabilityPath in internal user API (#2332)
Diffstat (limited to 'userapi')
-rw-r--r-- | userapi/inthttp/server.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/userapi/inthttp/server.go b/userapi/inthttp/server.go index f229aa3b..ad532b90 100644 --- a/userapi/inthttp/server.go +++ b/userapi/inthttp/server.go @@ -369,6 +369,19 @@ func AddRoutes(internalAPIMux *mux.Router, s api.UserInternalAPI) { return util.JSONResponse{Code: http.StatusOK, JSON: &response} }), ) + internalAPIMux.Handle(QueryAccountAvailabilityPath, + httputil.MakeInternalAPI("queryAccountAvailability", func(req *http.Request) util.JSONResponse { + request := api.QueryAccountAvailabilityRequest{} + response := api.QueryAccountAvailabilityResponse{} + if err := json.NewDecoder(req.Body).Decode(&request); err != nil { + return util.MessageResponse(http.StatusBadRequest, err.Error()) + } + if err := s.QueryAccountAvailability(req.Context(), &request, &response); err != nil { + return util.ErrorResponse(err) + } + return util.JSONResponse{Code: http.StatusOK, JSON: &response} + }), + ) internalAPIMux.Handle(QueryAccountByPasswordPath, httputil.MakeInternalAPI("queryAccountByPassword", func(req *http.Request) util.JSONResponse { request := api.QueryAccountByPasswordRequest{} |