AddTelNumbers implements POST /local/add/telNumbers
( req *http.Request, profileAPI userapi.ClientUserAPI, )
| 122 | |
| 123 | // AddTelNumbers implements POST /local/add/telNumbers |
| 124 | func AddTelNumbers( |
| 125 | req *http.Request, profileAPI userapi.ClientUserAPI, |
| 126 | ) util.JSONResponse { |
| 127 | r := struct { |
| 128 | Localpart string `json:"localpart"` |
| 129 | TelNumbers []int64 `json:"tel_numbers"` |
| 130 | }{} |
| 131 | if resErr := httputil.UnmarshalJSONRequest(req, &r); resErr != nil { |
| 132 | return *resErr |
| 133 | } |
| 134 | if r.Localpart == "" || len(r.TelNumbers) == 0 { |
| 135 | return util.JSONResponse{ |
| 136 | Code: http.StatusBadRequest, |
| 137 | JSON: jsonerror.BadJSON("invalid params."), |
| 138 | } |
| 139 | } |
| 140 | // TODO , |
| 141 | err := profileAPI.AddTelNumbers(req.Context(), r.Localpart, r.TelNumbers) |
| 142 | if err != nil { |
| 143 | return util.JSONResponse{ |
| 144 | Code: http.StatusBadRequest, |
| 145 | JSON: jsonerror.BadJSON("AddTelNumbers err."), |
| 146 | } |
| 147 | } |
| 148 | return util.JSONResponse{ |
| 149 | Code: http.StatusOK, |
| 150 | JSON: struct{}{}, |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | // AddMortgage implements POST /local/add/mortgage |
| 155 | func AddMortgage( |
no test coverage detected