@ -1161,26 +1161,25 @@
( :administrator )
;; Authorised
( cond ( ( utils:string-is-nil-or-empty? archive-slug )
( utils:set-alert "No archive slug provided. Thumbnail not updated."
( utils:set-alert
"No archive slug provided. Thumbnail not updated."
"missing-data" )
( redirect "/user/archive" ) )
( ( null ( nera:get-archive-entry :slug archive-slug ) )
( utils:set-alert "Cannot file thumbnail's archive entry. Nothing updated."
( utils:set-alert
"Cannot file thumbnail's archive entry. Nothing updated."
"missing-data" )
( redirect "/user/archive" ) )
( ( not ( str:contains? "image" ( caddr thumbnail-file ) :ignore-case t ) )
( utils:set-alert "File uploaded is not an image. Thumbnail not updated."
( utils:set-alert
"File uploaded is not an image. Thumbnail not updated."
"invalid-data" )
( redirect ( format nil "/edit/archive/~a" archive-slug ) ) )
( t ( storage:remove-file "" "archive"
( archive::thumbnail-slug-of
( nera:get-archive-entry :slug archive-slug ) ) )
( storage:store-file "" "archive"
( cadr thumbnail-file )
thumbnail-file )
( t ( let ( ( archive-entry ( nera:get-archive-entry :slug archive-slug ) ) )
( storage:remove-file
"" "archive" ( archive::thumbnail-slug-of archive-entry ) )
( storage:store-file
"" "archive" ( cadr thumbnail-file ) thumbnail-file )
( nera:update-archive-entry-property
:slug archive-slug
:property 'archive::thumbnail-file-type-of
@ -1190,17 +1189,14 @@
:property 'archive::thumbnail-slug-of
:value ( cadr thumbnail-file ) )
( utils:create-thumbnail
"archive"
( archive::thumbnail-slug-of
( nera:get-archive-entry :slug archive-slug ) )
t )
;; Integrate updating Meilisearch here.
"archive" ( archive::thumbnail-slug-of archive-entry ) t )
;; Meilisearch DB doesn't need updating because nothing
;; has changed from its perspective.
( utils:set-alert "Thumbnail updated." "success" )
( redirect ( format nil "/edit/archive/~a" archive-slug ) ) ) )
( redirect ( format nil "/edit/archive/~a" archive-slug ) ) ) ) )
;; Not Authorised
( progn ( utils:set-alert "You are not authorised to delete this archive entry."
( progn ( utils:set-alert
"You are not authorised to delete this archive entry."
"error" )
( redirect "/login" ) ) ) ) ) ) )
@ -1215,18 +1211,19 @@
;; Authorised
( cond ( ( find t ( mapcar #' utils:string-is-nil-or-empty?
` ( , id , archive-slug , new-title ) ) )
( utils:set-alert "Title and meta-data not provided. Archive entry not renamed."
( utils:set-alert
"Title and meta-data not provided. Archive entry not renamed."
"missing-data" )
( redirect "/user/archive" ) )
( ( null ( nera:get-archive-entry :slug archive-slug ) )
( utils:set-alert "Cannot file archive entry. Archive entry not updated."
( utils:set-alert
"Cannot file archive entry. Archive entry not updated."
"invalid-data" )
( redirect "/user/archive" ) )
( t ( storage:rename-content-file
"" "archive"
( archive::slug-of ( nera:get-archive-entry :id ( parse-integer id ) ) )
( t ( let ( ( archive-entry
( nera:get-archive-entry :id ( parse-integer id ) ) ) )
( storage:rename-content-file
"" "archive" ( archive::slug-of archive-entry )
( utils:format-filename ( format nil "~a.html" new-title ) ) )
( nera:update-archive-entry-property
:slug archive-slug
@ -1236,16 +1233,26 @@
:slug archive-slug
:property 'archive::slug-of
:value ( utils:format-filename ( format nil "~a.html" new-title ) ) )
;; Integrate updating Meilisearch here.
( search:submit-entry
( search:build-payload
( archive::search-id-of archive-entry )
new-title
( format nil "view/archive/~a.html"
( utils:slugify new-title ) )
( format nil
"storage/thumb/archive/~a.html"
( utils:slugify new-title ) )
( mito.dao.mixin:object-created-at archive-entry )
( archive::keywords-of archive-entry ) ) )
( utils:set-alert "Archive entry updated." "success" )
( redirect
( format nil
"/edit/archive/~a"
( utils:format-filename ( format nil "~a.html" new-title ) ) ) ) ) )
( utils:format-filename
( format nil "~a.html" new-title ) ) ) ) ) ) )
;; Not Authorised
( progn ( utils:set-alert "You are not authorised to delete this archive entry."
( progn ( utils:set-alert
"You are not authorised to delete this archive entry."
"error" )
( redirect "/login" ) ) ) ) ) ) )
@ -1312,26 +1319,27 @@
( :administrator )
;; Authorised
( cond ( ( utils:string-is-nil-or-empty? slug )
( utils:set-alert "Cannot find archive entry in database. Nothing deleted."
( utils:set-alert
"Cannot find archive entry in database. Nothing deleted."
"missing-data" )
( redirect "/user/archive" ) )
( ( and ( null ( storage:file-exists-p "" "archive" slug ) )
( null ( nera:get-archive-entry :slug slug ) ) )
( utils:set-alert "Unable to find archive entry. Nothing deleted."
( utils:set-alert
"Unable to find archive entry. Nothing deleted."
"invalid-data" )
( redirect "/user/archive" ) )
( ( and ( null ( storage:file-exists-p "" "archive" slug ) )
( not ( null ( nera:get-archive-entry :slug slug ) ) ) )
( nera:delete-archive-entry :slug slug )
( utils:set-alert "Couldn't find archive entry files. Deleted from database only."
( utils:set-alert
"Couldn't find archive entry files. Deleted from database only."
"invalid-data" )
( redirect "/user/archive" ) )
( ( and ( not ( null ( storage:file-exists-p "" "archive" slug ) ) )
( null ( nera:get-archive-entry :slug slug ) ) )
( utils:set-alert "Couldn't find archive entry in database. Deleted files only."
( utils:set-alert
"Couldn't find archive entry in database. Deleted files only."
"invalid-data" )
;; The thumbnail in not know about here because it was
;; linked to the text file via the database. You will need
@ -1340,21 +1348,18 @@
;; was already needed.
( storage:remove-file "" "archive" slug )
( redirect "/user/archive" ) )
( t ( storage:remove-file "" "archive" slug ) ; Archive Entry
;; Archive Entry Thumbnail
( t ( storage:remove-file "" "archive" slug )
( storage:remove-file
"" "archive" ( archive::thumbnail-slug-of
( nera:get-archive-entry :slug slug ) ) )
;; Meilisearch DB Entry
( search:delete-entry
( archive::search-id-of ( nera:get-archive-entry :slug slug ) ) )
;; DB Entry
( nera:delete-archive-entry :slug slug )
( utils:set-alert "Archive entry deleted." "success" )
( redirect "/user/archive" ) ) )
;; Not Authorised
( progn ( utils:set-alert "You are not authorised to delete this archive entry."
( progn ( utils:set-alert
"You are not authorised to delete this archive entry."
"error" )
( redirect "/login" ) ) ) ) ) ) )