From e4612d07116e09d6b8c63a128b842ce58338e72e Mon Sep 17 00:00:00 2001 From: Craig Oates Date: Sun, 18 Sep 2022 23:01:37 +0100 Subject: [PATCH] create pages package and page class (for Mito to map to DB). --- src/models/pages.lisp | 48 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 src/models/pages.lisp diff --git a/src/models/pages.lisp b/src/models/pages.lisp new file mode 100644 index 0000000..aa37763 --- /dev/null +++ b/src/models/pages.lisp @@ -0,0 +1,48 @@ +(in-package #:cl-user) +(defpackage #:pages + (:use #:cl + #:ritherdon-archive.db + #:mito + #:app-constants) + (:export #:page)) +(in-package #:pages) + +(defclass page () + ((title + :documentation "The title of the page." + :col-type (or :text :null) + :initarg :title + :initform :title + :accessor title-of) + + (slug + :documentation "The slugified version of the page `TITLE'. This is what is + used when constructing links and accessing the page from the browser." + :col-type (or :text :null) + :initarg :slug + :initform :null + :accessor slug-of) + + (enable-nav-menu + :documentation + "Boolean value stating if `PAGE' should be included on site's nav. menu." + :col-type (or :integer :null) + :initarg :enable-nav-menu + :initform +false+ ;SQLite 0 -> false 1 -> true. + :accessor enable-nav-menu-p) + + (can-delete + :documentation + "Specifies if the page can be deleted from the database. This is for + 'hard-coded' pages such as the 'archive' and 'pages'. The user won't make + these pages they come as part of the website which the use can add to the + nav. menu." + :col-type (or :integer :null) + :initarg :can-delete + :initform +false+ ;SQLite 0 -> false 1 -> true. + :accessor can-delete-p)) + + (:documentation "`PAGE' represents the meta-data for the pages made by the + `USER' which are stored in the database. The actual pages are stored in the + /storage/pages directory.") + (:metaclass mito:dao-table-class))