Line data Source code
1 4 : (ns schemas.api.resource)
2 :
3 :
4 4 : (def ResourceCreateRequestSchema
5 28 : [:map {:swagger/title "ResourceCreateRequest"
6 : :swagger/description "Request body for creating a club resource"}
7 8 : [:name
8 28 : [:string {:min 1
9 : :max 255}]]
10 8 : [:resource-type
11 28 : [:string {:min 1
12 : :max 50}]]
13 20 : [:is-active {:optional true}
14 12 : [:maybe :boolean]]
15 20 : [:attributes {:optional true}
16 12 : [:maybe :map]]])
17 :
18 :
19 4 : (def ResourceUpdateRequestSchema
20 28 : [:map {:swagger/title "ResourceUpdateRequest"
21 : :swagger/description "Request body for updating a club resource"}
22 20 : [:name {:optional true}
23 28 : [:string {:min 1
24 : :max 255}]]
25 20 : [:resource-type {:optional true}
26 28 : [:string {:min 1
27 : :max 50}]]
28 24 : [:is-active {:optional true}
29 : :boolean]
30 24 : [:attributes {:optional true}
31 : :map]])
32 :
33 :
34 4 : (def ResourceResponseBody
35 20 : [:map {:swagger/title "ResourceResponseBody"}
36 20 : [:uuid [:ref :types/UuidString]]
37 12 : [:public-id :string]
38 20 : [:club-id [:ref :types/UuidString]]
39 12 : [:name :string]
40 12 : [:resource-type :string]
41 12 : [:is-active :boolean]
42 12 : [:attributes :map]
43 12 : [:created-datetime :any]
44 12 : [:updated-datetime :any]])
45 :
46 :
47 4 : (def ResourceCreateResponseSchema
48 8 : [:or
49 68 : [:map [:status [:= 201]] [:body [:map [:message :string] [:data ResourceResponseBody]]]]
50 68 : [:map [:status [:= 400]] [:body [:map [:message :string] [:error :map]]]]])
51 :
52 :
53 4 : (def ResourceUpdateResponseSchema
54 8 : [:or
55 68 : [:map [:status [:= 200]] [:body [:map [:message :string] [:data ResourceResponseBody]]]]
56 56 : [:map [:status [:= 404]] [:body [:map [:message :string]]]]
57 68 : [:map [:status [:= 400]] [:body [:map [:message :string] [:error :map]]]]])
58 :
59 :
60 4 : (def ResourceListResponseSchema
61 64 : [:map [:status [:= 200]] [:body [:map [:data [:sequential ResourceResponseBody]]]]])
62 :
63 :
64 4 : (def ResourceGetResponseSchema
65 8 : [:or
66 56 : [:map [:status [:= 200]] [:body [:map [:data ResourceResponseBody]]]]
67 56 : [:map [:status [:= 404]] [:body [:map [:message :string]]]]])
68 :
69 :
70 4 : (def ResourceDeactivateResponseSchema
71 8 : [:or
72 68 : [:map [:status [:= 200]] [:body [:map [:message :string] [:data ResourceResponseBody]]]]
73 56 : [:map [:status [:= 404]] [:body [:map [:message :string]]]]])
74 :
75 :
76 4 : (def ResourceClubPathParamsSchema
77 20 : [:map {:swagger/title "ResourceClubPathParams"}
78 20 : [:club-uuid {:description "Club UUID"}
79 12 : [:ref :types/UuidString]]])
80 :
81 :
82 4 : (def ResourcePathParamsSchema
83 20 : [:map {:swagger/title "ResourcePathParams"}
84 20 : [:club-uuid {:description "Club UUID"}
85 12 : [:ref :types/UuidString]]
86 20 : [:resource-uuid {:description "Resource UUID"}
87 12 : [:ref :types/UuidString]]])
|