route to remove bot confirmation in case of error on confirm payout

This commit is contained in:
Rob Culliton 2018-05-15 12:58:43 -04:00
parent 2aa751769a
commit 9a5386a5fa
No known key found for this signature in database
GPG Key ID: 6FDEF60B3DC84D94
3 changed files with 21 additions and 1 deletions

View File

@ -428,6 +428,12 @@ UPDATE issues
SET is_open = :is_open
WHERE issue_id = :issue_id;
-- :name reset-bot-confirmation :! :n
-- :doc updates issue's execute and confirm hash
UPDATE issues
SET execute_hash = NULL,
confirm_hash = NULL
WHERE issue_id = :issue_id;
-- :name issue-exists :1
-- :doc returns true if given issue exists

View File

@ -95,6 +95,12 @@
(db/update-issue-open con-db {:issue_id issue-id
:is_open is-open})))
(defn reset-bot-confirmation
"resets execute and confirm hash to null for given issue id"
[issue-id]
(jdbc/with-db-connection [con-db *db*]
(db/reset-bot-confirmation con-db {:issue_id issue-id})))
(defn is-bounty-issue?
[issue-id]
(let [res (jdbc/with-db-connection [con-db *db*]

View File

@ -266,4 +266,12 @@
(ok {:issue-id issue-id
:execute-hash execute-hash
:contract-address contract-address})
(bad-request (str "Unable to withdraw funds from " contract-address)))))))))
(bad-request (str "Unable to withdraw funds from " contract-address))))))
(POST "/remove-bot-confirmation" {{issue-id :issue-id} :params}
:auth-rules authenticated?
:current-user user
(do (log/infof "calling remove-bot-confirmation for %s " issue-id)
;; if this resulted in updating a row, return success
(if (pos? (issues/reset-bot-confirmation issue-id))
(ok (str "Updated execute and confirm hash for " issue-id))
(bad-request (str "Unable to update execute and confirm hash for " issue-id))))))))