diff options
Diffstat (limited to 'web')
-rw-r--r-- | web/panettone/src/model.lisp | 31 | ||||
-rw-r--r-- | web/panettone/src/packages.lisp | 3 |
2 files changed, 33 insertions, 1 deletions
diff --git a/web/panettone/src/model.lisp b/web/panettone/src/model.lisp index 300ee19b6b10..d43478d45b3f 100644 --- a/web/panettone/src/model.lisp +++ b/web/panettone/src/model.lisp @@ -14,6 +14,34 @@ ;;; Schema ;;; +(defclass user-settings () + ((user-dn :col-type string :initarg :user-dn :accessor user-dn) + (enable-email-notifications + :col-type boolean + :initarg :enable-email-notifications + :accessor enable-email-notifications-p + :initform t + :col-default t)) + (:metaclass dao-class) + (:keys user-dn) + (:table-name user_settings) + (:documentation + "Panettone settings for an individual user DN")) + +(deftable (user-settings "user_settings") + (!dao-def)) + +(defun settings-for-user (dn) + "Retrieve the settings for the user with the given DN, creating a new row in + the database if not yet present" + (or + (car + (query-dao + 'user-settings + (:select '* :from 'user-settings :where (:= 'user-dn dn)))) + (insert-dao (make-instance 'user-settings :user-dn dn)))) + + (define-constant +issue-statuses+ '(:open :closed) :test #'equal) @@ -134,7 +162,8 @@ its new value will be formatted using ~A into NEW-VALUE")) (define-constant +all-tables+ '(issue issue-comment - issue-event) + issue-event + user-settings) :test #'equal) (defun ddl/create-tables () diff --git a/web/panettone/src/packages.lisp b/web/panettone/src/packages.lisp index 3b6edcdd14e3..3bdb553b7089 100644 --- a/web/panettone/src/packages.lisp +++ b/web/panettone/src/packages.lisp @@ -34,6 +34,9 @@ (:export :connect-postgres :ddl/init + :user-settings + :user-dn :enable-email-notifications-p :settings-for-user + :issue :issue-comment :issue-event :id :subject :body :author-dn :issue-id :status :created-at :acting-user-dn :field :previous-value :new-value |