summaryrefslogtreecommitdiff
path: root/lisp/sql/registration.lisp
blob: a1a2919062599a6d4d510eef70c86d8eed4ff701 (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
;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-
(declaim (optimize (speed 0) (safety 3) (debug 3)))

(in-package :woodriverlessons)

(defclass registration (postgres-record)
  ((id :initarg :id
       :initform nil
       :accessor id)
   (hash :initarg :hash
         :initform nil
         :accessor hash)
   (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)
   (role_groups :initarg :role_groups
                :initform nil
                :accessor role_groups)
   (created :initarg :created
            :initform nil)
   (valid_for :initarg :valid_for
              :initform nil
              :accessor valid_for)
   (*table :initform "auth.registrations")
   (*where-expression :initform "id = ~a"))
  (:documentation "Holds the data for an auth.registrations type."))

(defmethod created ((registration registration))
  (slot-value registration 'created))

(defmethod (setf created) (value (registration registration))
  (handler-case
      (setf (slot-value registration 'created) (simple-date-to-date value))
    (error (e)
      (declare (ignore e))
      (setf (slot-value registration 'created) nil))))