#| # File Attachments Attachment class for saving metadata into RDBMS See MITO-ATTACHMENT for more information: TODO AWS Storage / CC API Upload? Here's the bit of code for the FILEs: ;; (destructuring-bind (content filename content-type) ;; file ;; (if (and (eq (type-of content) 'flex::vector-input-stream) ;; (> (length (flex::vector-stream-vector content)) 0)) ;; ...)) |# (in-package #:cl-deck-builder2.models.attachment) (defclass attachment (mito-attachment:attachment) () (:metaclass registered-table-class)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun create-attachment (content file-key content-type) "Use CREATE-DAO to construct a new ATTACHMENT instance. Return the instance if successful, NIL otherwise." (create-dao 'attachment :content content :file-key file-key :content-type content-type)) (defun attachment-valid-p (file) "Helper function. Ensure FILE data from Caveman has valid: - Type: 'FLEX::VECTOR-INPUT-STREAM - Filename: Length > 0 - File Length: Content Length > 0" (destructuring-bind (content filename content-type) file ;; XXX Don't ignore content type? (declare (ignore content-type)) (and (eq (type-of content) 'flex::vector-input-stream) (> (length (flex::vector-stream-vector content)) 0) (> (length filename) 0))))