InsertRelationInvite implements POST /local/insert/relationInvite
( req *http.Request, profileAPI userapi.ClientUserAPI, )
| 64 | |
| 65 | // InsertRelationInvite implements POST /local/insert/relationInvite |
| 66 | func InsertRelationInvite( |
| 67 | req *http.Request, profileAPI userapi.ClientUserAPI, |
| 68 | ) util.JSONResponse { |
| 69 | var r types.RelationInvite |
| 70 | if resErr := httputil.UnmarshalJSONRequest(req, &r); resErr != nil { |
| 71 | return *resErr |
| 72 | } |
| 73 | if r.Inviter == "" || r.Invitee == "" { |
| 74 | return util.JSONResponse{ |
| 75 | Code: http.StatusBadRequest, |
| 76 | JSON: jsonerror.BadJSON("'inviter' and 'invitee' must be supplied."), |
| 77 | } |
| 78 | } |
| 79 | // TODO , |
| 80 | err := profileAPI.InsertRelationInvite(req.Context(), r.Inviter, r.Invitee, r.PresentFee) |
| 81 | if err != nil { |
| 82 | return util.JSONResponse{ |
| 83 | Code: http.StatusBadRequest, |
| 84 | JSON: jsonerror.BadJSON("InsertRelationInvite err."), |
| 85 | } |
| 86 | } |
| 87 | return util.JSONResponse{ |
| 88 | Code: http.StatusOK, |
| 89 | JSON: struct{}{}, |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | // InsertAddressBook implements POST /local/insert/addressBook |
| 94 | func InsertAddressBook( |
no test coverage detected