HandleFind returns an http.HandlerFunc that writes json-encoded user account information to the response body.
(userCtrl *user.Controller)
| 25 | // HandleFind returns an http.HandlerFunc that writes json-encoded |
| 26 | // user account information to the response body. |
| 27 | func HandleFind(userCtrl *user.Controller) http.HandlerFunc { |
| 28 | return func(w http.ResponseWriter, r *http.Request) { |
| 29 | ctx := r.Context() |
| 30 | session, _ := request.AuthSessionFrom(ctx) |
| 31 | userUID, err := request.GetUserUIDFromPath(r) |
| 32 | if err != nil { |
| 33 | render.TranslatedUserError(ctx, w, err) |
| 34 | return |
| 35 | } |
| 36 | |
| 37 | usr, err := userCtrl.Find(ctx, session, userUID) |
| 38 | if err != nil { |
| 39 | render.TranslatedUserError(ctx, w, err) |
| 40 | return |
| 41 | } |
| 42 | |
| 43 | render.JSON(w, http.StatusOK, usr) |
| 44 | } |
| 45 | } |
no test coverage detected
searching dependent graphs…