summaryrefslogtreecommitdiff
path: root/lisp/sql/contact-us.lisp
diff options
context:
space:
mode:
authorckonstanski <carlos.konstanski@olo.com>2024-05-25 18:03:25 -0600
committerckonstanski <carlos.konstanski@olo.com>2024-05-25 18:03:25 -0600
commitb8423f4d05c75094b7b9d09c6f0bb353acc9be1c (patch)
tree3732f71f84191b26f038130c2220fb502d738251 /lisp/sql/contact-us.lisp
initial commit
Diffstat (limited to 'lisp/sql/contact-us.lisp')
-rw-r--r--lisp/sql/contact-us.lisp50
1 files changed, 50 insertions, 0 deletions
diff --git a/lisp/sql/contact-us.lisp b/lisp/sql/contact-us.lisp
new file mode 100644
index 0000000..9a7f30b
--- /dev/null
+++ b/lisp/sql/contact-us.lisp
@@ -0,0 +1,50 @@
+;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-
+(declaim (optimize (speed 0) (safety 3) (debug 3)))
+
+(in-package :woodriverlessons)
+
+(defclass contact-us (postgres-record)
+ ((id :initarg :id
+ :initform nil
+ :accessor id)
+ (content :initarg :content
+ :initform nil
+ :accessor content)
+ (*table :initform "contact.contact_us")
+ (*where-expression :initform "id = ~a"))
+ (:documentation "Holds the data for a contact.contact_us type."))
+
+(defclass contact-us-post (postgres-record)
+ ((id :initarg :id
+ :initform nil
+ :accessor id)
+ (first_name :initarg :first_name
+ :initform nil
+ :accessor first_name)
+ (last_name :initarg :last_name
+ :initform nil
+ :accessor last_name)
+ (email :initarg :email
+ :initform nil
+ :accessor email)
+ (phone :initarg :phone
+ :initform nil
+ :accessor phone)
+ (submitted :initarg :submitted
+ :initform nil)
+ (comments :initarg :comments
+ :initform nil
+ :accessor comments)
+ (*table :initform "contact.get_contact_us_posts_by_id_and_read(~a, '~a')")
+ (*where-expression :initform nil))
+ (:documentation "Holds the data for a contact.contact_us_posts type."))
+
+(defmethod submitted ((contact-us-post contact-us-post))
+ (slot-value contact-us-post 'submitted))
+
+(defmethod (setf submitted) (value (contact-us-post contact-us-post))
+ (handler-case
+ (setf (slot-value contact-us-post 'submitted) (simple-date-to-date value))
+ (error (e)
+ (declare (ignore e))
+ (setf (slot-value contact-us-post 'submitted) nil))))