@ -36,7 +36,10 @@
#:get-storage-file
#:get-storage-file
#:get-all-storage-files
#:get-all-storage-files
#:rename-storage-file
#:rename-storage-file
#:delete-storage-file ) )
#:delete-storage-file
#:get-all-archive-entries
#:create-archive-entry
#:get-archive-entry ) )
( in-package #:nera-db )
( in-package #:nera-db )
( defparameter *tables* ' ( user site-settings page storage-file archive-entry )
( defparameter *tables* ' ( user site-settings page storage-file archive-entry )
@ -273,3 +276,31 @@ slug is updated based on `NEW-FILE-NAME'."
( if ( null slug )
( if ( null slug )
( mito:delete-by-values 'files:storage-file :name name )
( mito:delete-by-values 'files:storage-file :name name )
( mito:delete-by-values 'files:storage-file :slug slug ) ) ) )
( mito:delete-by-values 'files:storage-file :slug slug ) ) ) )
( defun get-all-archive-entries ( )
"Returns a list of all `ARCHIVE-ENTRY' entries in the database."
( with-connection ( db )
( 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 )
"Add a new `ARCHIVE-ENTRY' to the database."
( with-connection ( db )
( mito:create-dao 'archive:archive-entry
:title title
:search-id search-id
:slug slug
:thumbnail-slug thumbnail-slug
:thumbnail-file-type thumbnail-file-type
:keywords keywords ) ) )
( defun get-archive-entry ( &key id title slug )
"Returns a `ARCHIVE-ENTRY' from the database."
( with-connection ( db )
( cond ( ( and ( not title ) ( not slug ) )
( mito:find-dao 'archive:archive-entry :id id ) )
( ( and ( not id ) ( not slug ) )
( mito:find-dao 'archive:archive-entry :title title ) )
( ( and ( not id ) ( not title ) )
( mito:find-dao 'archive:archive-entry :slug slug ) )
( t nil ) ) ) )