|
|
@ -8,6 +8,7 @@ |
|
|
|
#:utils |
|
|
|
#:utils |
|
|
|
#:user |
|
|
|
#:user |
|
|
|
#:pages |
|
|
|
#:pages |
|
|
|
|
|
|
|
#:files |
|
|
|
#:site-settings) |
|
|
|
#:site-settings) |
|
|
|
(:export #:init-db |
|
|
|
(:export #:init-db |
|
|
|
#:update-user |
|
|
|
#:update-user |
|
|
@ -29,10 +30,13 @@ |
|
|
|
#:get-all-pages |
|
|
|
#:get-all-pages |
|
|
|
#:nav-menu-slugs |
|
|
|
#:nav-menu-slugs |
|
|
|
#:update-nav-menu |
|
|
|
#:update-nav-menu |
|
|
|
#:system-data)) |
|
|
|
#:system-data |
|
|
|
|
|
|
|
#:add-storage-file |
|
|
|
|
|
|
|
#:get-storage-file |
|
|
|
|
|
|
|
#:get-all-storage-files)) |
|
|
|
(in-package #:nera-db) |
|
|
|
(in-package #:nera-db) |
|
|
|
|
|
|
|
|
|
|
|
(defparameter *tables* '(user site-settings page) |
|
|
|
(defparameter *tables* '(user site-settings page storage-file) |
|
|
|
"List of the DB tables that need to be checked for migrations and DB setup.") |
|
|
|
"List of the DB tables that need to be checked for migrations and DB setup.") |
|
|
|
|
|
|
|
|
|
|
|
(defun init-db (request) |
|
|
|
(defun init-db (request) |
|
|
@ -228,3 +232,22 @@ |
|
|
|
(defun system-data () |
|
|
|
(defun system-data () |
|
|
|
"Gets the website's settings and nav-menu from database." |
|
|
|
"Gets the website's settings and nav-menu from database." |
|
|
|
(list (get-site-settings) (nav-menu-slugs))) |
|
|
|
(list (get-site-settings) (nav-menu-slugs))) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun add-storage-file (filename slug file-type) |
|
|
|
|
|
|
|
"Add a row to the 'storage_file' table in the database." |
|
|
|
|
|
|
|
(with-connection (db) |
|
|
|
|
|
|
|
(mito:create-dao 'storage-file |
|
|
|
|
|
|
|
:name filename |
|
|
|
|
|
|
|
:slug slug |
|
|
|
|
|
|
|
:file-type file-type))) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun get-storage-file (filename) |
|
|
|
|
|
|
|
"Returns a `STORAGE-FILE' row from the database. `NIL' if nothing found." |
|
|
|
|
|
|
|
(with-connection (db) |
|
|
|
|
|
|
|
(mito:find-dao 'storage-file :name filename))) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun get-all-storage-files () |
|
|
|
|
|
|
|
"Returns a list of all `STORAGE-FILES' entries in the database." |
|
|
|
|
|
|
|
(with-connection (db) |
|
|
|
|
|
|
|
(mito:select-dao 'storage-file |
|
|
|
|
|
|
|
(sxql:order-by (:asc :name))))) |
|
|
|