From 19deba35c497922805da93e190443ded1e4fedad Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Fri, 15 Dec 2023 15:31:50 -0600 Subject: [PATCH] Tweaking to figure out the nextcloud apis --- TODO.org | 2 +- src/main.lisp | 29 +++++++++++++---------------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/TODO.org b/TODO.org index 8b9cc98..ba353b6 100644 --- a/TODO.org +++ b/TODO.org @@ -8,6 +8,6 @@ The multiline text options do not grab the entire entry. I'll need to fix that b * DONE Make single newline show up multiline text options do not include a single newline. They showup as a SPACE and a TAB * TODO Fix the lisp server to use nextcloud tables -SCHEDULED: <2023-12-14 Thu 12:00> +SCHEDULED: <2023-12-18 Mon 12:00> ** TODO Setup the lisp server on the actual server and test there for a while. diff --git a/src/main.lisp b/src/main.lisp index 38c178f..a3e693c 100644 --- a/src/main.lisp +++ b/src/main.lisp @@ -1,5 +1,6 @@ (require "hunchentoot") (require "dexador") +(require "drakma") (require "com.inuoe.jzon") (require "serapeum") (require "bordeaux-threads") @@ -246,16 +247,9 @@ *last-list-data* :test 'string=)))))) - (setq special-data `#(("columnId" 37 "value" ,(serapeum:trim-whitespace - (cdr (assoc - "Student Name" - *last-list-data* - :test 'string=)))))) - (dex:post "https://staff.tfcconnection.org/apps/tables/api/1/tables/4/rows" :basic-auth '("chris" . "2VHeGxeC^Zf9KqFK^G@Pt!zu2q^6@b") - :content (stringify `(("tableId" . 4) - ("data" . ,special-data))) + :content `(("data" . ,(stringify special-data))) :verbose t) )) @@ -493,17 +487,20 @@ with the image attached" (acons name content form-list)))) nil) (if (string= "image" name) - (progn (format t "~&~A: ~A" name image-file-name) - (setq form-list - (acons name image-file-name form-list)) - (save-string-file - (apply #'concatenate 'string content) - image-file-name) - (setf attachment image-file-name))) + (progn + (format t "~&~A: ~A" name image-file-name) + (if (uiop:file-exists-p image-file-name) + (progn + (setq form-list + (acons name image-file-name form-list)) + (save-string-file + (apply #'concatenate 'string content) + image-file-name) + (setf attachment image-file-name))))) (setq *last-list-data* (append *last-list-data* form-list)))) - ;; (post-health-form *last-list-data*) + (post-health-form *last-list-data*) (if (mail-form *last-list-data* attachment) (format nil "thankyou")))))))