/
quicklaunches.clj
104 lines (76 loc) · 3.02 KB
/
quicklaunches.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
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
(ns common-swagger-api.schema.quicklaunches
(:use [common-swagger-api.schema :only [describe NonBlankString]]
[common-swagger-api.schema.analyses :only [AnalysisSubmission]])
(:require [schema.core :as s]
[schema-tools.core :as st])
(: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 QuickLaunch
{:id
(describe UUID "The UUID for the quick launch")
:name
(describe NonBlankString "The name of the quick launch")
(s/optional-key :description)
(describe String "The description of the quick launch")
:creator
(describe NonBlankString "The username for the creator of the quick launch")
:app_id
(describe UUID "The UUID for the app the quick launch is associated with")
(s/optional-key :is_public)
(describe Boolean "Whether the quick launch is publicly available. Defaults to false")
:submission
AnalysisSubmission})
(s/defschema NewQuickLaunch
(st/dissoc QuickLaunch :id :user)) ;user should be included in the request query params
(s/defschema UpdateQuickLaunch
(-> QuickLaunch
(st/dissoc :id)
(st/optional-keys-schema)))
(s/defschema QuickLaunchFavorite
{:id
(describe UUID "The UUID for the quick launch favorite entry")
:quick_launch_id
(describe UUID "The UUID of the quick launch that was favorited")
:user
(describe NonBlankString "The username of the user that favorited the quick launch")})
(s/defschema NewQuickLaunchFavorite
(st/dissoc QuickLaunchFavorite :id :user)) ;user is in query params, id is auto-assigned.
; Mostly just useful for admin operations. Users will either create or remove favorites.
(s/defschema UpdateQuickLaunchFavorite
(-> QuickLaunchFavorite
(st/dissoc :id)
(st/optional-keys-schema)))
(s/defschema QuickLaunchUserDefault
{:id
(describe UUID "The UUID for the quick launch user default")
:user
(describe NonBlankString "The username of the user that is using the quick launch as the default for the app")
:app_id
(describe UUID "The UUID of the app for which the user default is being set")
:quick_launch_id
(describe UUID "The UUID of the quick launch being used as the default for the app")})
(s/defschema NewQuickLaunchUserDefault
(st/dissoc QuickLaunchUserDefault :id :user))
(s/defschema UpdateQuickLaunchUserDefault
(-> QuickLaunchUserDefault
(st/dissoc :id)
(st/optional-keys-schema)))
(s/defschema QuickLaunchGlobalDefault
{:id
(describe UUID "The UUID for the quick launch global default")
:app_id
(describe UUID "The UUID for the app which has a global default")
:quick_launch_id
(describe UUID "The UUID for the quick launch that is the global default for the app")})
(s/defschema NewQuickLaunchGlobalDefault
(st/dissoc QuickLaunchGlobalDefault :id))
(s/defschema UpdateQuickLaunchGlobalDefault
(-> QuickLaunchGlobalDefault
(st/dissoc :id)
(st/optional-keys-schema)))