Browse Source

integrate Meilisearch into edit keywords functionality (web.lisp).

stable
Craig Oates 2 years ago
parent
commit
f38e0aef42
  1. 27
      src/web.lisp

27
src/web.lisp

@ -1270,21 +1270,32 @@
(utils:set-alert "Keywords not provided. Not updated." (utils:set-alert "Keywords not provided. Not updated."
"missing-data") "missing-data")
(redirect "/user/archive")) (redirect "/user/archive"))
((null (nera:get-archive-entry :slug archive-slug)) ((null (nera:get-archive-entry :slug archive-slug))
(utils:set-alert "Cannot file archive entry. Keywords not updated." (utils:set-alert
"Cannot file archive entry. Keywords not updated."
"invalid-data") "invalid-data")
(redirect "/user/archive")) (redirect "/user/archive"))
(t (let ((archive-entry (nera:get-archive-entry :slug archive-slug))
(t (nera:update-archive-entry-property (keywords (utils:format-keywords new-keywords)))
(nera:update-archive-entry-property
:slug archive-slug :slug archive-slug
:property 'archive::keywords-of :property 'archive::keywords-of
:value (utils:format-keywords new-keywords)) :value keywords)
;; Integrate updating Meilisearch here. (search:submit-entry
(search:build-payload
(archive::search-id-of archive-entry)
(archive::title-of archive-entry)
(format nil "view/archive/~a"
(archive::slug-of archive-entry))
(format nil "storage/thumb/archive/~a"
(archive::slug-of archive-entry))
(mito.dao.mixin:object-created-at archive-entry)
keywords))
(utils:set-alert "Archive entry updated." "success") (utils:set-alert "Archive entry updated." "success")
(redirect (format nil "/edit/archive/~a" archive-slug)))) (redirect (format nil "/edit/archive/~a" archive-slug)))))
;; Not Authorised ;; 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") "error")
(redirect "/login"))))))) (redirect "/login")))))))

Loading…
Cancel
Save