|
|
|
@ -60,3 +60,18 @@
|
|
|
|
|
(catch js/Error err (js/console.log (ex-cause err)))))
|
|
|
|
|
channel)
|
|
|
|
|
|
|
|
|
|
(defn delete-article
|
|
|
|
|
"Delete an article and return the id via channel. It gets and returns the same channel."
|
|
|
|
|
[client id channel]
|
|
|
|
|
(go
|
|
|
|
|
(try
|
|
|
|
|
(let [res (<p! (.query client
|
|
|
|
|
"delete from articles where id = $1 returning id;"
|
|
|
|
|
(clj->js [id])))]
|
|
|
|
|
(>! channel (-> (.-rows res)
|
|
|
|
|
(js->clj :keywordize-keys true)
|
|
|
|
|
(first)
|
|
|
|
|
(:id))))
|
|
|
|
|
(catch js/Error err (js/console.log (ex-cause err)))))
|
|
|
|
|
channel)
|
|
|
|
|
|
|
|
|
|