/
badges.clj
37 lines (28 loc) · 924 Bytes
/
badges.clj
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
(ns common-swagger-api.schema.badges
(:use [common-swagger-api.schema :only [describe NonBlankString]])
(:require [schema.core :as s]
[schema-tools.core :as st]
[common-swagger-api.schema.apps :refer [AnalysisSubmission]])
(:import [java.util UUID]))
(s/defschema Submission
{:id
(describe UUID "The UUID for this submission")
:submission
AnalysisSubmission})
(s/defschema NewSubmission
(st/dissoc Submission :id))
(s/defschema Badge
{:id
(describe UUID "The UUID for the badge")
:name
(describe NonBlankString "The name for the badge")
:user
(describe NonBlankString "The username of the user that owns the object")
:submission
AnalysisSubmission})
(s/defschema NewBadge
(st/dissoc Badge :id :user)) ;user should be included in the request query params
(s/defschema UpdateBadge
(-> Badge
(st/dissoc :id)
(st/optional-keys-schema)))