Browse Source

implement update-archive-entry-property in nera package.

stable
Craig Oates 2 years ago
parent
commit
379bbdc8b4
  1. 20
      src/nera.lisp

20
src/nera.lisp

@ -40,7 +40,8 @@
#:get-all-archive-entries
#:create-archive-entry
#:get-archive-entry
#:delete-archive-entry))
#:delete-archive-entry
#:update-archive-entry-property))
(in-package #:nera-db)
(defparameter *tables* '(user site-settings page storage-file archive-entry)
@ -284,7 +285,8 @@ slug is updated based on `NEW-FILE-NAME'."
(mito:select-dao 'archive:archive-entry
(sxql:order-by (:asc :title)))))
(defun create-archive-entry (title search-id slug thumbnail-slug thumbnail-file-type keywords)
(defun create-archive-entry
(title search-id slug thumbnail-slug thumbnail-file-type keywords)
"Add a new `ARCHIVE-ENTRY' to the database."
(with-connection (db)
(mito:create-dao 'archive:archive-entry
@ -306,6 +308,20 @@ slug is updated based on `NEW-FILE-NAME'."
(mito:find-dao 'archive:archive-entry :slug slug))
(t nil))))
(defun update-archive-entry-property (&key slug property value)
"Updates an `ARCHIVE-ENTRY' entry in database.
An example of how to use this function is as follows (remove back-slashes):
(nera:update-archive-entry-property
:slug \"edit-archive-test.html\"
:propery 'archive::keywords-of
:value \"test,image\")"
(with-connection (db)
(let ((entry-to-update
(mito:find-dao 'archive:archive-entry :slug slug)))
(eval `(setf (,property ,entry-to-update) ,value))
(mito:save-dao entry-to-update))))
(defun delete-archive-entry (&key id slug)
"Delete `ARCHIVE-ENTRY' from the database."
(with-connection (db)

Loading…
Cancel
Save