From 51354fd19f76c2cbfd31542e9c072b86a90134f0 Mon Sep 17 00:00:00 2001 From: ckonstanski Date: Tue, 21 Jul 2026 15:26:40 -0600 Subject: added education --- lisp/service/menu-service.lisp | 1 + lisp/service/resume-service.lisp | 142 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 140 insertions(+), 3 deletions(-) (limited to 'lisp/service') diff --git a/lisp/service/menu-service.lisp b/lisp/service/menu-service.lisp index a01c5f8..00dff60 100644 --- a/lisp/service/menu-service.lisp +++ b/lisp/service/menu-service.lisp @@ -6,6 +6,7 @@ (defparameter *menu-config* '((:id "a_menu_home" :label "Home" :handler "/home" :permissions "_Public") (:id "a_menu_resumes" :label "Resumes" :handler "/resumes" :permissions "resume-view") (:id "a_menu_resumes_contactinfo" :label "Contact Info" :handler "/resumes/contactinfo" :permissions "resume-view") + (:id "a_menu_resumes_education" :label "Education" :handler "/resumes/education" :permissions "resume-view") (:id "a_menu_contact_us" :label "Contact Me" :handler "/contact-us" :permissions "_Public") (:id "a_menu_messages" :label "Messages" :handler "/messages" :permissions "messages-view") (:id "a_menu_users" :label "Users" :handler "/users" :permissions "users-view"))) diff --git a/lisp/service/resume-service.lisp b/lisp/service/resume-service.lisp index 7e3aa71..8994595 100644 --- a/lisp/service/resume-service.lisp +++ b/lisp/service/resume-service.lisp @@ -99,7 +99,7 @@ (intersection `(,x) '(id))) (sb-introspect:function-lambda-list #'resumes-modify-submit-json)) do (setf (slot-value resume param) (symbol-value param))) - (update-resume resume-pkg resume) + (update-record resume-pkg resume) (setf (session-value :message) (format nil "Resume \"~a\" modified successfully." (name resume)))) (error (e) (setf (session-value :errormsg) (format nil "Error modifying resume \"~a\". ~a" name e))))))) @@ -235,7 +235,7 @@ (intersection `(,x) '(id))) (sb-introspect:function-lambda-list #'contactinfo-modify-submit-json)) do (setf (slot-value contactinfo param) (symbol-value param))) - (update-contactinfo resume-pkg contactinfo) + (update-record resume-pkg contactinfo) (setf (session-value :message) (format nil "Contact Info \"~a, ~a\" modified successfully." address city))) (error (e) (setf (session-value :errormsg) (format nil "Error modifying Contact Info \"~a, ~a\". ~a" address city e))))))) @@ -252,6 +252,142 @@ (contactinfo (get-record resume-pkg (make-instance 'contactinfo :id id :user_id (id user))))) (if contactinfo (progn - (delete-contactinfo resume-pkg contactinfo) + (delete-record resume-pkg contactinfo) (setf (session-value :message) (format nil "Contact Info \"~a, ~a\" deleted successfully." (address contactinfo) (city contactinfo)))) (setf (session-value :errormsg) "Error: could not delete Contact Info: not found.")))))) + +;; education + +(defun education-json () + (with-auth (instance resumes-service "resume-view") + (setf (title instance) "Education"))) + +(defclass education/view-service (resumes-service education) + ((educations :initarg :educations + :initform nil + :accessor educations) + (location-p :initform nil)) + (:documentation "")) + +(defun education-view-json () + (with-auth (instance education/view-service "resume-view") + (with-resume-database + (let ((resume-pkg (make-instance 'resume-pkg)) + (user (get-user))) + (setf (educations instance) (get-all-education resume-pkg user)))) + (sanitize-rest-json instance) + (loop for education in (educations instance) + do (sanitize-json education)))) + +(defclass education/add-service (education/view-service) + ((form :initarg :form + :initform nil + :accessor form)) + (:documentation "")) + +(defun education-add-json () + (with-auth (instance education/add-service "resume-modify") + (with-resume-database + (let* ((resume-pkg (make-instance 'resume-pkg)) + (user (get-user))) + (setf (title instance) "Education - Add") + (setf (form instance) (make-form "education-add-form" + nil + t + `((:name "school" :label "School" :field-type "text" :required "required") + (:name "major" :label "Major" :field-type "text" :required "required") + (:name "minor" :label "Minor" :field-type "text") + (:name "degree" :label "Degree" :field-type "text" :required "required") + (:name "progress" :label "Progress" :field-type "text" :required "required") + (:name "start_date" :label "Start Date" :field-type "text" :placeholder "MM/YYYY" :required "required") + (:name "end_date" :label "End Date" :field-type "text" :placeholder "MM/YYYY" :required "required") + (:label "Add Education" :field-type "button" :onclick "on_education_add_submit_clicked()")))))))) + +(defun education-add-submit-json (school major minor degree progress start_date end_date) + (declare (special school major minor degree progress start_date end_date)) + (with-auth (instance education/add-service "resume-modify") + (with-resume-database + (handler-case + (let* ((resume-pkg (make-instance 'resume-pkg)) + (user (get-user)) + (education (make-instance 'education :user_id (id user)))) + (loop for param in (remove-if (lambda (x) + (intersection `(,x) '(id))) + (sb-introspect:function-lambda-list #'education-add-submit-json)) + do (setf (slot-value education param) (symbol-value param))) + (insert-education resume-pkg education) + (setf (session-value :message) (format nil "Education \"~a, ~a\" created successfully." school major))) + (error (e) + (setf (session-value :errormsg) (format nil "Error creating Education \"~a, ~a\". ~a" school major e))))))) + +(defclass education/modify-service (education/add-service) + () + (:documentation "")) + +(defun education-modify-json (id) + (with-auth (instance education/modify-service "resume-modify") + (setf (title instance) "Education - Modify") + (with-resume-database + (let* ((resume-pkg (make-instance 'resume-pkg)) + (user (get-user)) + (education (get-record resume-pkg (make-instance 'education :id id :user_id (id user))))) + (if education + (setf (form instance) (make-form "education-modify-form" + nil + t + `((:name "id" :field-type "hidden" :value ,(id education) :required "required") + (:name "school" :label "School" :field-type "text" :value ,(school education) :required "required") + (:name "major" :label "Major" :field-type "text" :value ,(major education) :required "required") + (:name "minor" :label "Minor" :field-type "text" :value ,(minor education)) + (:name "degree" :label "Degree" :field-type "text" :value ,(degree education) :required "required") + (:name "progress" :label "Progress" :field-type "text" :value ,(progress education) :required "required") + (:name "start_date" :label "Start Date" :field-type "datetime-local" :value ,(start_date education) :required "required") + (:name "end_date" :label "End Date" :field-type "datetime-local" :value ,(end_date education) :required "required") + (:label "Modify Education" :field-type "button" :onclick "on_education_modify_submit_clicked()")))) + (setf (session-value :errormsg) "Error: could not modify Education. Not found.")))))) + +(defun education-modify-submit-json (id school major minor degree progress start_date end_date) + (declare (special id school major minor degree progress start_date end_date)) + (with-auth (instance education/modify-service "resume-modify") + (setf (title instance) "Education - Modify") + (with-resume-database + (handler-case + (let* ((resume-pkg (make-instance 'resume-pkg)) + (user (get-user)) + (education (get-record resume-pkg (make-instance 'education :id id :user_id (id user))))) + (loop for param in (remove-if (lambda (x) + (intersection `(,x) '(id))) + (sb-introspect:function-lambda-list #'education-modify-submit-json)) + do (setf (slot-value education param) (symbol-value param))) + (update-record resume-pkg education) + (setf (session-value :message) (format nil "Education \"~a, ~a\" modified successfully." school major))) + (error (e) + (setf (session-value :errormsg) (format nil "Error modifying Education \"~a, ~a\". ~a" school major e))))))) + +(defclass education/delete-service (education/add-service) + () + (:documentation "")) + +(defun education-delete-json (id) + (with-auth (instance education/delete-service "resume-modify") + (with-resume-database + (let* ((resume-pkg (make-instance 'resume-pkg)) + (user (get-user)) + (education (get-record resume-pkg (make-instance 'education :id id :user_id (id user))))) + (if education + (progn + (delete-record resume-pkg education) + (setf (session-value :message) (format nil "Education \"~a, ~a\" deleted successfully." (school education) (major education)))) + (setf (session-value :errormsg) "Error: could not delete Education: not found.")))))) + +;; language + + + +(defun language-options (level) + (mapcar (lambda (level) + `(:label level :value level)) + '("A1" "A2" "B1" "B2" "C1" "C2"))) + + + -- cgit v1.3