(ctx context.Context, m schema.Mutation)
| 18 | ) |
| 19 | |
| 20 | func resolveResetPassword(ctx context.Context, m schema.Mutation) (*resolve.Resolved, bool) { |
| 21 | inp, err := getPasswordInput(m) |
| 22 | if err != nil { |
| 23 | glog.Error("Failed to parse the reset password input") |
| 24 | } |
| 25 | if err = (&edgraph.Server{}).ResetPassword(ctx, inp); err != nil { |
| 26 | return resolve.EmptyResult(m, err), false |
| 27 | } |
| 28 | |
| 29 | return resolve.DataResult( |
| 30 | m, |
| 31 | map[string]interface{}{ |
| 32 | m.Name(): map[string]interface{}{ |
| 33 | "userId": inp.UserID, |
| 34 | "message": "Reset password is successful", |
| 35 | "namespace": json.Number(strconv.Itoa(int(inp.Namespace))), |
| 36 | }, |
| 37 | }, |
| 38 | nil, |
| 39 | ), true |
| 40 | |
| 41 | } |
| 42 | |
| 43 | func getPasswordInput(m schema.Mutation) (*edgraph.ResetPasswordInput, error) { |
| 44 | var input edgraph.ResetPasswordInput |
nothing calls this directly
no test coverage detected