summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorckonstanski <carlos.konstanski@olo.com>2024-05-27 14:52:07 -0600
committerckonstanski <carlos.konstanski@olo.com>2024-05-27 14:52:07 -0600
commite30ee019294e2abbbd3644b73e4327ae17df4392 (patch)
tree44d03581f96d81e0990f0664c01e725de542e9c2 /lisp
parent42e351bb04d38b01a1d5b251cdbc0caaa4be3712 (diff)
gallery
Diffstat (limited to 'lisp')
-rw-r--r--lisp/service/auth-service.lisp7
-rw-r--r--lisp/service/gallery-service.lisp133
-rw-r--r--lisp/service/menu-service.lisp1
-rw-r--r--lisp/service/users-service.lisp3
-rw-r--r--lisp/sql/gallery.lisp30
-rw-r--r--lisp/sql/general-pkg.lisp32
-rw-r--r--lisp/sql/generics.lisp12
-rw-r--r--lisp/webapps/woodriverlessons/clojurescript/woodriverlessons/src/core.cljs201
-rw-r--r--lisp/webapps/woodriverlessons/site.lisp40
-rw-r--r--lisp/woodriverlessons.asd4
10 files changed, 450 insertions, 13 deletions
diff --git a/lisp/service/auth-service.lisp b/lisp/service/auth-service.lisp
index 9509385..b6ce12e 100644
--- a/lisp/service/auth-service.lisp
+++ b/lisp/service/auth-service.lisp
@@ -39,3 +39,10 @@
(setf (session-value :message) nil)
(setf (session-value :errormsg) nil))
(org-ckons-json::objects-to-json `(,,instance))))
+
+(defmacro with-noauth-raw ((instance rest-service) &body body)
+ `(let ((,instance (make-instance ',rest-service)))
+ (when (location-p ,instance)
+ (setf (session-value :message) nil)
+ (setf (session-value :errormsg) nil))
+ ,@body))
diff --git a/lisp/service/gallery-service.lisp b/lisp/service/gallery-service.lisp
new file mode 100644
index 0000000..df709cd
--- /dev/null
+++ b/lisp/service/gallery-service.lisp
@@ -0,0 +1,133 @@
+;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-
+(declaim (optimize (speed 0) (safety 3) (debug 3)))
+
+(in-package :woodriverlessons)
+
+(defclass gallery-service (auth-service)
+ ((admin-p :initarg :admin-p
+ :initform nil
+ :accessor admin-p))
+ (:documentation ""))
+
+(defun gallery-json ()
+ (with-noauth (instance gallery-service)
+ (with-valid-user (user "gallery-modify")
+ (setf (admin-p instance) nil)
+ (setf (admin-p instance) t))))
+
+(defclass gallery/view-service (gallery-service)
+ ((results :initarg :results
+ :initform nil
+ :accessor results)
+ (location-p :initform nil))
+ (:documentation ""))
+
+(defun gallery-view-json ()
+ (with-noauth (instance gallery/view-service)
+ (with-valid-user (user "gallery-modify")
+ (setf (admin-p instance) nil)
+ (setf (admin-p instance) t))
+ (with-woodriverlessons-database
+ (let ((general-pkg (make-instance 'general-pkg)))
+ (setf (results instance) (get-galleries general-pkg))))
+ (setf (message instance) (session-value :message))
+ (sanitize-rest-json instance)
+ (loop for gallery in (results instance)
+ do (sanitize-json gallery))))
+
+(defclass gallery/add-modify-delete-service (gallery/view-service)
+ ((form :initarg :form
+ :initform nil
+ :accessor form))
+ (:documentation ""))
+
+(defun gallery-add-json ()
+ (with-auth (instance gallery/add-modify-delete-service "gallery-modify")
+ (setf (form instance) (make-form "gallery-add-form"
+ nil
+ t
+ `((:name "description" :label "Description" :field-type "textarea")
+ (:name "upload" :label "Image/Video" :field-type "file" :required "required")
+ (:label "Add Gallery" :field-type "button" :onclick "on_gallery_add_submit_clicked()"))))))
+
+(defun gallery-add-submit-json (description upload)
+ (declare (special description))
+ (with-auth (instance gallery/add-modify-delete-service "gallery-modify")
+ (with-woodriverlessons-database
+ (let ((general-pkg (make-instance 'general-pkg))
+ (gallery (make-instance 'gallery))
+ (tmp-filepath (first upload))
+ (orig-filename (second upload))
+ new-filepath)
+ (loop for param in (remove-if (lambda (x)
+ (intersection `(,x) `(upload)))
+ (sb-introspect:function-lambda-list #'gallery-add-submit-json))
+ do (setf (slot-value gallery param) (symbol-value param)))
+ (let ((tmpdir (tmpdir:mkdtemp :prefix "woodriverlessons-gallery-")))
+ (setf new-filepath (format nil "~a~a" tmpdir (file-namestring tmp-filepath)))
+ (fad:copy-file tmp-filepath new-filepath)
+ (setf (filename gallery) orig-filename)
+ (setf (mime_type gallery) (org-ckons-file::get-mime-type new-filepath))
+ (setf (content gallery) (org-ckons-file::file-as-hex new-filepath)))
+ (insert-gallery general-pkg gallery)
+ (setf (session-value :message) "Gallery added successfully.")))))
+
+(defun gallery-modify-json (id)
+ (with-auth (instance gallery/add-modify-delete-service "gallery-modify")
+ (with-woodriverlessons-database
+ (let* ((general-pkg (make-instance 'general-pkg))
+ (gallery (get-gallery general-pkg id)))
+ (if gallery
+ (setf (form instance) (make-form "gallery-modify-form"
+ nil
+ t
+ `((:name "id" :field-type "hidden" :value ,(id gallery) :required "required")
+ (:name "description" :label "Description" :value ,(description gallery) :field-type "textarea")
+ (:name "upload" :label "Image/Video" :field-type "file")
+ (:label "Modify Gallery" :field-type "button" :onclick "on_gallery_modify_submit_clicked()"))))
+ (setf (session-value :errormsg) "Error: could not modify gallery. Not found."))))))
+
+(defun gallery-modify-submit-json (id description upload)
+ (declare (special description))
+ (with-auth (instance gallery/add-modify-delete-service "gallery-modify")
+ (with-woodriverlessons-database
+ (let* ((general-pkg (make-instance 'general-pkg))
+ (gallery (get-gallery general-pkg id)))
+ (if gallery
+ (let ((tmp-filepath (first upload))
+ (orig-filename (second upload))
+ new-filepath)
+ (loop for param in (remove-if (lambda (x)
+ (intersection `(,x) `(upload)))
+ (sb-introspect:function-lambda-list #'gallery-add-submit-json))
+ do (setf (slot-value gallery param) (symbol-value param)))
+ (when upload
+ (let ((tmpdir (tmpdir:mkdtemp :prefix "woodriverlessons-gallery-")))
+ (setf new-filepath (format nil "~a~a" tmpdir (file-namestring tmp-filepath)))
+ (fad:copy-file tmp-filepath new-filepath)
+ (setf (filename gallery) orig-filename)
+ (setf (mime_type gallery) (org-ckons-file::get-mime-type new-filepath))
+ (setf (content gallery) (org-ckons-file::file-as-hex new-filepath))))
+ (update-gallery general-pkg gallery)
+ (setf (session-value :message) "Gallery saved successfully."))
+ (setf (session-value :errormsg) "An error occurred."))))))
+
+(defun gallery-delete-json (id)
+ (with-auth (instance gallery/add-modify-delete-service "gallery-modify")
+ (with-woodriverlessons-database
+ (let* ((general-pkg (make-instance 'general-pkg))
+ (gallery (get-gallery general-pkg id)))
+ (if gallery
+ (progn
+ (delete-record general-pkg gallery)
+ (setf (session-value :message) "Gallery deleted successfully."))
+ (setf (session-value :errormsg) "Error: could not delete gallery. Not found."))))))
+
+(defun gallery-file-view (id)
+ (with-noauth-raw (instance gallery/view-service)
+ (with-woodriverlessons-database
+ (let* ((general-pkg (make-instance 'general-pkg))
+ (gallery (get-gallery general-pkg id)))
+ (when gallery
+ (setf (org-ckons-session::content-type *header-register*) (mime_type gallery))
+ (ironclad:hex-string-to-byte-array (content gallery)))))))
diff --git a/lisp/service/menu-service.lisp b/lisp/service/menu-service.lisp
index 3c1c705..8bb7d9a 100644
--- a/lisp/service/menu-service.lisp
+++ b/lisp/service/menu-service.lisp
@@ -5,6 +5,7 @@
(defparameter *menu-config* '((:id "a_menu_home" :label "Home" :handler "/home" :permissions "_Public")
(:id "a_menu_about_us" :label "About the Studio" :handler "/about-us" :permissions "_Public")
+ (:id "a_menu_gallery" :label "Gallery" :handler "/gallery" :permissions "_Public")
;;(:id "a_menu_testimonials" :label "Testimonials" :handler "/testimonials" :permissions "_Public")
(:id "a_menu_contact_us" :label "Contact Me" :handler "/contact-us" :permissions "_Public")
(:id "a_menu_messages" :label "Messages" :handler "/messages" :permissions "messages-view")
diff --git a/lisp/service/users-service.lisp b/lisp/service/users-service.lisp
index 1c317ae..e41d5e4 100644
--- a/lisp/service/users-service.lisp
+++ b/lisp/service/users-service.lisp
@@ -61,8 +61,7 @@
`((:name "first_name" :label "First Name" :field-type "text" :required "required")
(:name "last_name" :label "Last Name" :field-type "text" :required "required")
(:name "email" :label "Email" :field-type "text" :required "required")
- ,@(role-checkboxes role-groups
- `(,(get-role-group-by-name auth-pkg user "emails-viewer")))
+ ,@(role-checkboxes role-groups)
(:label "Add User" :field-type "button" :onclick "on_users_add_submit_clicked()"))))))))
(defun users-add-submit-json (role_groups first_name last_name email)
diff --git a/lisp/sql/gallery.lisp b/lisp/sql/gallery.lisp
new file mode 100644
index 0000000..2f4231d
--- /dev/null
+++ b/lisp/sql/gallery.lisp
@@ -0,0 +1,30 @@
+;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-
+(declaim (optimize (speed 0) (safety 3) (debug 3)))
+
+(in-package :woodriverlessons)
+
+(defclass gallery (postgres-record)
+ ((id :initarg :id
+ :initform nil
+ :accessor id)
+ (description :initarg :description
+ :initform nil
+ :accessor description)
+ (filename :initarg :filename
+ :initform nil
+ :accessor filename)
+ (mime_type :initarg :mime_type
+ :initform nil
+ :accessor mime_type)
+ (content :initarg :content
+ :initform nil
+ :accessor content)
+ (created :initarg :created
+ :initform nil
+ :accessor created)
+ (modified :initarg :modified
+ :initform nil
+ :accessor modified)
+ (*table :initform "general.gallery")
+ (*where-expression :initform "id = ~a"))
+ (:documentation "Holds the data for a general.gallery type."))
diff --git a/lisp/sql/general-pkg.lisp b/lisp/sql/general-pkg.lisp
index 162d60b..5a92ed4 100644
--- a/lisp/sql/general-pkg.lisp
+++ b/lisp/sql/general-pkg.lisp
@@ -8,7 +8,35 @@
(:documentation ""))
(defmethod get-about-us ((general-pkg general-pkg))
- (car (get-records general-pkg (make-instance 'about-us) nil)))
+ (get-record general-pkg (make-instance 'about-us)))
(defmethod get-testimonials ((general-pkg general-pkg))
- (car (get-records general-pkg (make-instance 'testimonials) nil)))
+ (get-record general-pkg (make-instance 'testimonials)))
+
+(defmethod get-gallery ((general-pkg general-pkg) id)
+ (let ((gallery (make-instance 'gallery :*table (format nil "general.get_gallery(~a)" id))))
+ (get-record general-pkg gallery)))
+
+(defmethod get-galleries ((general-pkg general-pkg))
+ (let ((gallery (make-instance 'gallery :*table (format nil "general.get_galleries()"))))
+ (get-records general-pkg gallery nil)))
+
+(defmethod insert-gallery ((general-pkg general-pkg) (gallery gallery))
+ (setf (*table gallery) (format nil
+ "general.insert_gallery('~a', '~a', '~a', '~a')"
+ (description gallery)
+ (filename gallery)
+ (mime_type gallery)
+ (content gallery)))
+ (setf (id gallery) (caar (call-pg-function general-pkg gallery)))
+ (id gallery))
+
+(defmethod update-gallery ((general-pkg general-pkg) (gallery gallery))
+ (setf (*table gallery) (format nil
+ "general.update_gallery(~a, '~a', '~a', '~a', '~a')"
+ (id gallery)
+ (description gallery)
+ (filename gallery)
+ (mime_type gallery)
+ (content gallery)))
+ (caar (call-pg-function general-pkg gallery)))
diff --git a/lisp/sql/generics.lisp b/lisp/sql/generics.lisp
index 708856a..e45327c 100644
--- a/lisp/sql/generics.lisp
+++ b/lisp/sql/generics.lisp
@@ -94,6 +94,18 @@ sessionid."))
(defgeneric get-testimonials (record-pkg)
(:documentation "Gets the one and only general.testimonials record."))
+(defgeneric get-gallery (general-pkg id)
+ (:documentation "Gets a general.gellery record by id."))
+
+(defgeneric get-galleries (general-pkg)
+ (:documentation "Gets all general.gallery records sorted by modified desc."))
+
+(defgeneric insert-gallery (general-pkg gallery)
+ (:documentation "Inserta a new general.gallery record."))
+
+(defgeneric update-gallery (general-pkg gallery)
+ (:documentation "Updates an existing general.gallery record."))
+
(defgeneric get-contact-us-posts (record-pkg user-id read-p)
(:documentation "Gets contact.contact_us_posts records."))
diff --git a/lisp/webapps/woodriverlessons/clojurescript/woodriverlessons/src/core.cljs b/lisp/webapps/woodriverlessons/clojurescript/woodriverlessons/src/core.cljs
index aa6dc58..94066fa 100644
--- a/lisp/webapps/woodriverlessons/clojurescript/woodriverlessons/src/core.cljs
+++ b/lisp/webapps/woodriverlessons/clojurescript/woodriverlessons/src/core.cljs
@@ -69,6 +69,27 @@
(declare on-about-us-modify-submit-clicked)
(declare handler-about-us-modify-submit)
(declare render-about-us-modify-submit)
+(declare render-gallery)
+(declare template-gallery-view)
+(declare handler-gallery-view)
+(declare render-gallery-view)
+(declare on-gallery-add-clicked)
+(declare template-gallery-add)
+(declare handler-gallery-add)
+(declare render-gallery-add)
+(declare on-gallery-add-submit-clicked)
+(declare handler-gallery-add-submit)
+(declare render-gallery-add-submit)
+(declare on-gallery-modify-clicked)
+(declare template-gallery-modify)
+(declare handler-gallery-modify)
+(declare render-gallery-modify)
+(declare on-gallery-modify-submit-clicked)
+(declare handler-gallery-modify-submit)
+(declare render-gallery-modify-submit)
+(declare on-gallery-delete-clicked)
+(declare handler-gallery-delete)
+(declare render-gallery-delete)
(declare template-testimonials)
(declare handler-testimonials)
(declare render-testimonials)
@@ -534,6 +555,185 @@
:params {:content (dommy/value (dommy/sel1 :#txt-content))}
:handler handler-about-us-modify-submit}))
+;; gallery
+
+(hiccups/defhtml template-gallery [jsonobj]
+ [:h1 {:style "text-align: center"} "Gallery"]
+ [:div {:id "content"}]
+ [:div {:id "modify"
+ :class "modal fade"
+ :role "dialog"}
+ [:div {:class "modal-dialog modal-lg"}
+ [:div {:class "modal-content"}
+ [:div {:class "modal-header"}
+ [:h5 [:span {:id "modify-title"}]]
+ [:button {:type "button"
+ :class "close"
+ :data-dismiss "modal"}
+ "&times;"]]
+ [:div {:id "modify-body"
+ :class "modal-body"
+ :style "height: 425px;"}]
+ [:div {:class "modal-footer"}
+ [:button {:type "submit"
+ :class "btn btn-danger btn-default"
+ :data-dismiss "modal"}
+ [:span {:class "glyphicon glyphicon-remove"}]
+ "Cancel"]]]]])
+
+(defn handler-gallery [response]
+ (let [jsonobj (js->clj (js/JSON.parse response))]
+ (auth-notifications jsonobj)
+ (dommy/set-html! (dommy/sel1 :#body) (template-gallery jsonobj))
+ (render-gallery-view)))
+
+(defn render-gallery []
+ (GET "/gallery" {:handler handler-gallery}))
+
+;; gallery-view
+
+(hiccups/defhtml template-gallery-view [jsonobj]
+ [:div {:style "text-align: right"}
+ (when (get jsonobj "adminP")
+ [:img {:src "/static/images/add.png"
+ :style "cursor:pointer; cursor:hand"
+ :onclick (str (namespace ::x) ".on_gallery_add_clicked()")}])]
+ (let [results (get jsonobj "results")]
+ (cond (empty? results)
+ [:h5 {:style "text-align: center"} "No results found."]
+ :else
+ [:table {:class "table table-hover"}
+ [:thead
+ [:tr
+ [:th {:scope "col"} "ID"]
+ [:th {:scope "col"} "Description"]
+ [:th {:scope "col"} "Image/Video"]
+ (when (get jsonobj "adminP")
+ [:th {:scope "col" :style "text-align: right;"} "Del"])]]
+ [:tbody
+ (for [rec results]
+ (let [onclick (cond (get jsonobj "adminP")
+ (str (namespace ::x) ".on_gallery_modify_clicked(" (get rec "id") ")")
+ :else
+ "javascript:void")]
+ [:tr
+ [:td {:onclick onclick} (get rec "id")]
+ [:td {:onclick onclick} (get rec "description")]
+ [:td
+ [:embed {:src (str "/gallery/file/view?id=" (get rec "id"))
+ :type (get rec "mime_type")
+ :height "400"}]]
+ (when (get jsonobj "adminP")
+ [:td {:style "text-align: right;"}
+ [:img {:src "/static/images/delete.png"
+ :onclick (str (namespace ::x) ".on_gallery_delete_clicked(" (get rec "id") ")")}]])]))]])))
+
+(defn handler-gallery-view [response]
+ (let [jsonobj (js->clj (js/JSON.parse response))]
+ (auth-notifications jsonobj)
+ (dommy/set-html! (dommy/sel1 :#content) (template-gallery-view jsonobj))))
+
+(defn render-gallery-view []
+ (GET "/gallery/view" {:handler handler-gallery-view}))
+
+;; gallery-add
+
+(defn on-gallery-add-clicked []
+ (render-gallery-add))
+
+(hiccups/defhtml template-gallery-add [jsonobj]
+ (ck-form/template-generic-form (get jsonobj "form") (namespace ::x)))
+
+(defn handler-gallery-add [response]
+ (let [jsonobj (js->clj (js/JSON.parse response))]
+ (auth-notifications jsonobj)
+ (dommy/set-html! (dommy/sel1 :#modify-title) "Gallery - Add")
+ (dommy/set-html! (dommy/sel1 :#modify-body) (template-gallery-add jsonobj))
+ (.modal (jquery "#modify"))))
+
+(defn render-gallery-add []
+ (POST "/gallery/add" {:handler handler-gallery-add}))
+
+;; gallery-add-submit
+
+(defn on-gallery-add-submit-clicked []
+ (when (-> (jquery "#gallery-add-form")
+ (.get "0")
+ (.checkValidity))
+ (.modal (jquery "#modify") "hide")
+ (render-gallery-add-submit)))
+
+(defn handler-gallery-add-submit [response]
+ (let [jsonobj (js->clj (js/JSON.parse response))]
+ (auth-notifications jsonobj)
+ (on-menu-clicked "/gallery")))
+
+(defn render-gallery-add-submit []
+ (let [form-data (js/FormData. (dommy/sel1 :#gallery-add-form))]
+ (POST "/gallery/add/submit"
+ {:body form-data
+ :response-format (raw-response-format)
+ :handler handler-gallery-add-submit})))
+
+;; gallery-modify
+
+(defn on-gallery-modify-clicked [id]
+ (render-gallery-modify id))
+
+(hiccups/defhtml template-gallery-modify [jsonobj]
+ (ck-form/template-generic-form (get jsonobj "form") (namespace ::x)))
+
+(defn handler-gallery-modify [response]
+ (let [jsonobj (js->clj (js/JSON.parse response))]
+ (auth-notifications jsonobj)
+ (dommy/set-html! (dommy/sel1 :#modify-title) "Gallery - Modify")
+ (dommy/set-html! (dommy/sel1 :#modify-body) (template-gallery-modify jsonobj))
+ (.modal (jquery "#modify"))))
+
+(defn render-gallery-modify [id]
+ (POST "/gallery/modify"
+ {:format :raw
+ :params {:id id}
+ :handler handler-gallery-modify}))
+
+;; gallery-modify-submit
+
+(defn on-gallery-modify-submit-clicked []
+ (when (-> (jquery "#gallery-modify-form")
+ (.get "0")
+ (.checkValidity))
+ (.modal (jquery "#modify") "hide")
+ (render-gallery-modify-submit)))
+
+(defn handler-gallery-modify-submit [response]
+ (let [jsonobj (js->clj (js/JSON.parse response))]
+ (auth-notifications jsonobj)
+ (on-menu-clicked "/gallery")))
+
+(defn render-gallery-modify-submit []
+ (let [form-data (js/FormData. (dommy/sel1 :#gallery-modify-form))]
+ (POST "/gallery/modify/submit"
+ {:body form-data
+ :response-format (raw-response-format)
+ :handler handler-gallery-add-submit})))
+
+;; gallery-delete
+
+(defn on-gallery-delete-clicked [id]
+ (when (js/confirm (str "Are you sure you want to delete " id "? This action cannot be undone."))
+ (render-gallery-delete id)))
+
+(defn handler-gallery-delete [response]
+ (let [jsonobj (js->clj (js/JSON.parse response))]
+ (auth-notifications jsonobj)
+ (on-menu-clicked "/gallery")))
+
+(defn render-gallery-delete [id]
+ (POST "/gallery/delete"
+ {:format :raw
+ :params {:id id}
+ :handler handler-gallery-delete}))
+
;; testimonials
(hiccups/defhtml template-testimonials [jsonobj]
@@ -1043,6 +1243,7 @@
(= handler "/profile") (render-profile)
(= handler "/password") (render-password)
(= handler "/about-us") (render-about-us)
+ (= handler "/gallery") (render-gallery)
(= handler "/testimonials") (render-testimonials)
(= handler "/contact-us") (render-contact-us)
(= handler "/messages") (render-messages)
diff --git a/lisp/webapps/woodriverlessons/site.lisp b/lisp/webapps/woodriverlessons/site.lisp
index 7ccd929..a1a6a82 100644
--- a/lisp/webapps/woodriverlessons/site.lisp
+++ b/lisp/webapps/woodriverlessons/site.lisp
@@ -95,6 +95,30 @@
(defmacro .about-us-modify-submit ()
`(about-us-modify-submit-json content))
+(defmacro .gallery ()
+ `(gallery-json))
+
+(defmacro .gallery-view ()
+ `(gallery-view-json))
+
+(defmacro .gallery-add ()
+ `(gallery-add-json))
+
+(defmacro .gallery-add-submit ()
+ `(gallery-add-submit-json description upload))
+
+(defmacro .gallery-modify ()
+ `(gallery-modify-json id))
+
+(defmacro .gallery-modify-submit ()
+ `(gallery-modify-submit-json id description upload))
+
+(defmacro .gallery-delete ()
+ `(gallery-delete-json id))
+
+(defmacro .gallery-file-view ()
+ `(gallery-file-view id))
+
(defmacro .testimonials ()
`(testimonials-json))
@@ -116,12 +140,6 @@
(defmacro .contact-us-email ()
`(contact-us-email-json first_name last_name email phone comments))
-(defmacro .contact-us-modify ()
- `(contact-us-modify-json))
-
-(defmacro .contact-us-modify-submit ()
- `(contact-us-modify-submit-json content))
-
(defmacro .messages ()
`(messages-json))
@@ -184,6 +202,14 @@
(define-endpoint :get "/about-us/view" () .about-us-view)
(define-endpoint :post "/about-us/modify" () .about-us-modify)
(define-endpoint :post "/about-us/modify/submit" ((content :parameter-type 'string)) .about-us-modify-submit)
+(define-endpoint :get "/gallery" () .gallery)
+(define-endpoint :get "/gallery/view" () .gallery-view)
+(define-endpoint :post "/gallery/add" () .gallery-add)
+(define-endpoint :post "/gallery/add/submit" ((description :parameter-type 'string) (upload :parameter-type 'string)) .gallery-add-submit)
+(define-endpoint :post "/gallery/modify" ((id :parameter-type 'integer)) .gallery-modify)
+(define-endpoint :post "/gallery/modify/submit" ((id :parameter-type 'integer) (description :parameter-type 'string) (upload :parameter-type 'string)) .gallery-modify-submit)
+(define-endpoint :post "/gallery/delete" ((id :parameter-type 'integer)) .gallery-delete)
+(define-endpoint :get "/gallery/file/view" ((id :parameter-type 'integer)) .gallery-file-view)
(define-endpoint :get "/testimonials" () .testimonials)
(define-endpoint :get "/testimonials/view" () .testimonials-view)
(define-endpoint :post "/testimonials/modify" () .testimonials-modify)
@@ -191,8 +217,6 @@
(define-endpoint :get "/contact-us" () .contact-us)
(define-endpoint :get "/contact-us/view" () .contact-us-view)
(define-endpoint :post "/contact-us/email" ((first_name :parameter-type 'string) (last_name :parameter-type 'string) (email :parameter-type 'string) (phone :parameter-type 'string) (comments :parameter-type 'string)) .contact-us-email)
-(define-endpoint :post "/contact-us/modify" () .contact-us-modify)
-(define-endpoint :post "/contact-us/modify/submit" ((content :parameter-type 'string)) .contact-us-modify-submit)
(define-endpoint :get "/messages" () .messages)
(define-endpoint :post "/messages/results" ((read :parameter-type 'string)) .messages-results)
(define-endpoint :post "/messages/mark" ((read :parameter-type 'string) (id :parameter-type 'integer)) .messages-mark)
diff --git a/lisp/woodriverlessons.asd b/lisp/woodriverlessons.asd
index 6c6a9cb..2ceb824 100644
--- a/lisp/woodriverlessons.asd
+++ b/lisp/woodriverlessons.asd
@@ -45,8 +45,9 @@
(:file "about-us" :depends-on ("generics"))
(:file "testimonials" :depends-on ("generics"))
(:file "contact-us" :depends-on ("generics"))
+ (:file "gallery" :depends-on ("generics"))
(:file "auth-pkg" :depends-on ("user-session-pkg" "user" "role-group" "user-role" "registration"))
- (:file "general-pkg" :depends-on ("about-us" "testimonials"))
+ (:file "general-pkg" :depends-on ("about-us" "testimonials" "gallery"))
(:file "contact-pkg" :depends-on ("contact-us"))))
(:module service
:depends-on (sql)
@@ -62,6 +63,7 @@
(:file "profile-service" :depends-on ("generic-form" "auth-service"))
(:file "password-service" :depends-on ("generic-form" "auth-service"))
(:file "about-us-service" :depends-on ("generic-form" "auth-service"))
+ (:file "gallery-service" :depends-on ("generic-form" "auth-service"))
(:file "testimonials-service" :depends-on ("generic-form" "auth-service"))
(:file "contact-us-service" :depends-on ("generic-form" "auth-service"))
(:file "users-service" :depends-on ("generic-form" "auth-service"))