summaryrefslogtreecommitdiff
path: root/lisp/sql/resume-pkg.lisp
blob: c45a6e1b1321448569c749c3b8ab8fa906a24079 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-
(declaim (optimize (speed 0) (safety 3) (debug 3)))

(in-package :resume)

(defclass resume-pkg (record-pkg)
  ()
  (:documentation ""))

;; resumes

(defmethod get-all-resumes ((resume-pkg resume-pkg) (user user))
    (let ((resume (make-instance 'resume :user_id (id user))))
      (get-records resume-pkg resume "name asc")))

(defmethod insert-resume ((resume-pkg resume-pkg) (resume resume))
  (setf (*table resume) (format nil
                                "resume.insert_resume(~a, '~a')"
                                (user_id resume)
                                (name resume)))
  (caar (call-pg-function resume-pkg resume)))

(defmethod delete-resume ((resume-pkg resume-pkg) (resume resume))
  (setf (*table resume) (format nil
                                "resume.delete_resume(~a)"
                                (id resume)))
  (caar (call-pg-function resume-pkg resume)))

;; contactinfo

(defmethod get-all-contactinfo ((resume-pkg resume-pkg) (user user))
  (let ((contactinfo-v (make-instance 'contactinfo-v :user_id (id user))))
    (get-records resume-pkg contactinfo-v "state_name asc, city asc, address asc, email asc, phone asc, visastatus asc")))

(defmethod insert-contactinfo ((resume-pkg resume-pkg) (contactinfo contactinfo))
  (setf (*table contactinfo) (format nil
                                     "resume.insert_contactinfo(~a, ~a, ~a, '~a', '~a', '~a', '~a')"
                                     (user_id contactinfo)
                                     (state_id contactinfo)
                                     (visastatus_id contactinfo)
                                     (address contactinfo)
                                     (city contactinfo)
                                     (phone contactinfo)
                                     (email contactinfo)))
  (caar (call-pg-function resume-pkg contactinfo)))

;; education

(defmethod get-all-education ((resume-pkg resume-pkg) (user user))
  (let ((education (make-instance 'education :user_id (id user))))
    (get-records resume-pkg education "school asc, end_date asc, major asc, minor asc")))

(defmethod insert-education ((resume-pkg resume-pkg) (education education))
  (setf (*table education) (format nil
                                     "resume.insert_education(~a, '~a', '~a', '~a', '~a', '~a', '~a', '~a')"
                                     (user_id education)
                                     (school education)
                                     (start_date education)
                                     (end_date education)
                                     (major education)
                                     (minor education)
                                     (degree education)
                                     (progress education)))
  (caar (call-pg-function resume-pkg education)))

;; language

(defmethod get-all-languages ((resume-pkg resume-pkg) (user user))
  (let ((language (make-instance 'language :user_id (id user))))
    (get-records resume-pkg language "name asc")))

(defmethod insert-language ((resume-pkg resume-pkg) (language language))
  (setf (*table language) (format nil
                                     "resume.insert_language(~a, '~a', '~a', '~a', '~a', '~a', '~a')"
                                     (user_id language)
                                     (name language)
                                     (understanding_listening language)
                                     (understanding_reading language)
                                     (speaking_interaction language)
                                     (speaking_production language)
                                     (writing language)))
  (caar (call-pg-function resume-pkg language)))

;; job