 (defn delete! [ctx user-badge-id endorsement-id user-id]
   (try+
     (if (or (endorsement-owner? ctx endorsement-id user-id) (badge-owner? ctx user-badge-id user-id ))
-      (do (delete-user-badge-endorsement! {:id endorsement-id} (get-db ctx))
+      (do
+        (delete-user-badge-endorsement! {:id endorsement-id} (get-db ctx))
+        (send-badge-info-to-obf ctx user-badge-id user-id)
         {:status "success"})
       {:status "error"}
       )


(defqueries "sql/badge/main.sql")

(defn external-id []
  (str "urn:uuid:" (java.util.UUID/randomUUID)))

(defn badge-owner? [ctx badge-id user-id]

    (if (badge-owner? ctx user-badge-id user-id)
      (throw+ {:status "error" :message "User cannot endorse himself"})
      (when-let [id (->> (insert-user-badge-endorsement<! {:user_badge_id user-badge-id
                                                           :external_id (generate-external-id)
                                                           :endorser_id user-id
                                                           :content content} (get-db ctx))
                         :generated_key)]
