@ -41,7 +41,10 @@
#:create-archive-entry
#:get-archive-entry
#:delete-archive-entry
#:update-archive-entry-property ) )
#:update-archive-entry-property
#:latest-archive-editted-entries
#:latest-editted-pages
#:latest-storage-editted-files ) )
( in-package #:nera-db )
( defparameter *tables* ' ( user site-settings page storage-file archive-entry )
@ -161,6 +164,17 @@
( mito:select-dao 'page
( sxql:order-by ( :asc :slug ) ) ) ) )
( defun latest-editted-pages ( amount &optional reverse )
" Gets the latest ` AMOUNT ' of edited entries from the database.
` REVERSE ' is an optional parameter which puts the most recently
editted article entry as the first item in the list.. "
( with-connection ( db )
( mito:select-dao 'pages:page
( sxql:limit amount )
( if reverse
( sxql:order-by ( :desc 'pages::updated-at ) )
( sxql:order-by 'pages::updated-at ) ) ) ) )
( defun create-page ( title slug nav-menu can-delete )
"Add a new `PAGE' to the database."
( with-connection ( db )
@ -258,6 +272,17 @@
( mito:find-dao 'files:storage-file :name filename )
( mito:find-dao 'files:storage-file :slug slug ) ) ) )
( defun latest-storage-editted-files ( amount &optional reverse )
" Gets the latest ` AMOUNT ' of edited entries from the database.
` REVERSE ' is an optional parameter which puts the most recently
editted article entry as the first item in the list.. "
( with-connection ( db )
( mito:select-dao 'storage-file
( sxql:limit amount )
( if reverse
( sxql:order-by ( :desc 'storage::updated-at ) )
( sxql:order-by 'storage::updated-at ) ) ) ) )
( defun get-all-storage-files ( )
"Returns a list of all `STORAGE-FILES' entries in the database."
( with-connection ( db )
@ -310,6 +335,17 @@ slug is updated based on `NEW-FILE-NAME'."
( mito:find-dao 'archive:archive-entry :slug slug ) )
( t nil ) ) ) )
( defun latest-archive-editted-entries ( amount &optional reverse )
" Gets the latest ` AMOUNT ' of edited entries from the database.
` REVERSE ' is an optional parameter which puts the most recently
editted article entry as the first item in the list.. "
( with-connection ( db )
( mito:select-dao 'archive:archive-entry
( sxql:limit amount )
( if reverse
( sxql:order-by ( :desc 'archive::updated-at ) )
( sxql:order-by 'archive::updated-at ) ) ) ) )
( 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 ) :