-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path#defmodule.lisp#
55 lines (39 loc) · 1.52 KB
/
#defmodule.lisp#
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
;;;; defmodule.lisp
(restas:define-policy datastore
(:interface-package #:linkdemo.policy.datastore)
(:interface-method-template "DATASTORE-~A")
(:internal-package #:linkdemo.datastore)
(define-method init ()
"initiate the datastore")
(define-method find-user (username)
"Find the user by username")
(define-method auth-user (username password)
"Check if a user exists and has the suplied password")
(define-method register-user (username password)
"Register a new user")
(define-method upvoted-p (link-id username)
"Check if a user has upvoted a link")
(define-method upvote (link-id user)
"upvote a link")
(define-method post-link (url title user)
"post a new link")
(define-method get-all-links (&optional user)
"Get all of the links in the datastore")
(define-method upvote-count (link-id)
"get the number of upvotes for a given link"))
(restas:define-module #:linkdemo
(:use #:cl #:restas #:linkdemo.datastore)
(:export #:start-linkdemo))
(defpackage #:linkdemo.pg-datastore
(:use #:cl #:postmodern #:linkdemo.policy.datastore)
(:export #:pg-datastore))
(in-package #:linkdemo)
(defparameter *template-directory*
(merge-pathnames #P"templates/" linkdemo-config:*base-directory*))
(defparameter *static-directory*
(merge-pathnames #P"static/" linkdemo-config:*base-directory*))
(sexml:with-compiletime-active-layers
(sexml:standard-sexml sexml:xml-doctype)
(sexml:support-dtd
(merge-pathnames "html5.dtd" (asdf:system-source-directory "sexml"))
:<))