func (u Url) UpdateUrl(filter_query interface{}, update_data interface{}) error { err := mongo.Update(u, filter_query, update_data) if err != nil { return err } return err }
func AddCallbackHandler(w http.ResponseWriter, r *http.Request) { application := Application{} vars := mux.Vars(r) applicationId := vars["applicationId"] token := r.FormValue("token") body, err := ioutil.ReadAll(r.Body) if err != nil { w.WriteHeader(400) } isAuthenticated, err := IsAuthenticated(token, applicationId) if isAuthenticated != true { w.WriteHeader(403) return } callback := Callback{} json.Unmarshal(body, &callback) mongo.Update(application, bson.M{"_id": bson.ObjectIdHex(applicationId)}, bson.M{"$set": bson.M{"callbackurl": callback.CallbackUrl}}) }