aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2020-07-08 02:15:40 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2020-07-08 02:15:40 +0200
commit2e0c177d40419c92a93a45eb7efd136341ec52cc (patch)
tree00c524d8b02aba959567d568591bc739d832cde8
parentAdd xcal class to unformatted xml. (diff)
downloadcalp-2e0c177d40419c92a93a45eb7efd136341ec52cc.tar.gz
calp-2e0c177d40419c92a93a45eb7efd136341ec52cc.tar.xz
Add /remove POST endpoint.
-rw-r--r--module/entry-points/server.scm12
1 files changed, 12 insertions, 0 deletions
diff --git a/module/entry-points/server.scm b/module/entry-points/server.scm
index a0afa0f8..0698daf0 100644
--- a/module/entry-points/server.scm
+++ b/module/entry-points/server.scm
@@ -105,6 +105,18 @@
intervaltype: 'month
))))))
+
+ (POST "/remove" (uid)
+ (unless uid
+ (return (build-response code: 400)
+ "uid required"))
+
+ (aif (get-event-by-uid uid)
+ (begin (remove-event it)
+ (return (build-response code: 204) ""))
+ (return (build-response code: 400)
+ (format #f "No event with UID '~a'" uid))))
+
;; TODO this fails when dtstart is <date>.
(POST "/insert" (cal data)