InsertChainData implements POST /local/insert/chainData
( req *http.Request, profileAPI userapi.ClientUserAPI, )
| 37 | |
| 38 | // InsertChainData implements POST /local/insert/chainData |
| 39 | func InsertChainData( |
| 40 | req *http.Request, profileAPI userapi.ClientUserAPI, |
| 41 | ) util.JSONResponse { |
| 42 | var r types.UserChainInfo |
| 43 | if resErr := httputil.UnmarshalJSONRequest(req, &r); resErr != nil { |
| 44 | return *resErr |
| 45 | } |
| 46 | if r.Localpart == "" { |
| 47 | return util.JSONResponse{ |
| 48 | Code: http.StatusBadRequest, |
| 49 | JSON: jsonerror.BadJSON("'localpart' must be supplied."), |
| 50 | } |
| 51 | } |
| 52 | err := profileAPI.InsertChainData(req.Context(), r.Localpart, r.Servername, r.ChatFee, r.MortgageFee) |
| 53 | if err != nil { |
| 54 | return util.JSONResponse{ |
| 55 | Code: http.StatusBadRequest, |
| 56 | JSON: jsonerror.BadJSON("InsertChainData err."), |
| 57 | } |
| 58 | } |
| 59 | return util.JSONResponse{ |
| 60 | Code: http.StatusOK, |
| 61 | JSON: struct{}{}, |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | // InsertRelationInvite implements POST /local/insert/relationInvite |
| 66 | func InsertRelationInvite( |
no test coverage detected