Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (de event/add ()
- (httpHead "application/json" 0)
- (let (Body *body
- JsonBody (json-decode Body)
- Token (getFromBody "token" JsonBody)
- Origin (getFromBody "origin" JsonBody)
- Now (now)
- OriginDB (db 'name '+EventOrigin Origin)
- Content (getFromBody "content" JsonBody))
- (msg "Here")
- (if (and Token Origin Now Content OriginDB)
- (let (EventResult (addEvent Origin Content Token))
- (msg EventResult)
- (cond
- ((match '(Ok . @Resp) EventResult) (jsonResponse NIL (cons "msg" '@Resp)))
- ((match '(Error . @Resp) EventResult) (jsonResponse T (cons "errorMsg" '@Resp)))
- (T (jsonResponse (cons "errorMsg" "Cannot parse response from DB")))))
- (jsonResponse T (cons "errorMsg" "Missing param"))
- )))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement