@@ -24,219 +24,6 @@ const schema = a.schema({
24
24
data : a . json ( ) ,
25
25
} )
26
26
. authorization ( allow => [ allow . publicApiKey ( ) , allow . owner ( ) ] ) ,
27
- ThingWithCustomerOwnerField : a
28
- . model ( {
29
- id : a . id ( ) ,
30
- description : a . string ( ) ,
31
- } )
32
- . authorization ( allow => [ allow . ownerDefinedIn ( 'customField' , 'userPools' ) ] ) ,
33
- ThingWithOwnerFieldSpecifiedInModel : a
34
- . model ( {
35
- id : a . id ( ) ,
36
- name : a . string ( ) ,
37
- owner : a . string ( ) ,
38
- } )
39
- . authorization ( allow => [ allow . owner ( ) ] ) ,
40
- ThingWithAPIKeyAuth : a
41
- . model ( {
42
- id : a . id ( ) ,
43
- description : a . string ( ) ,
44
- } )
45
- . authorization ( allow => [ allow . publicApiKey ( ) ] ) ,
46
- ThingWithoutExplicitAuth : a . model ( {
47
- id : a . id ( ) ,
48
- description : a . string ( ) ,
49
- } ) ,
50
- ThingWithCustomPk : a
51
- . model ( {
52
- cpk_cluster_key : a . string ( ) . required ( ) ,
53
- cpk_sort_key : a . string ( ) . required ( ) ,
54
- otherField : a . string ( ) ,
55
- } )
56
- . identifier ( [ 'cpk_cluster_key' , 'cpk_sort_key' ] ) ,
57
-
58
- CommunityPostMetadata : a . customType ( {
59
- type : a . string ( ) . required ( ) ,
60
- deleted : a . boolean ( ) ,
61
- } ) ,
62
-
63
- CommunityPost : a . model ( {
64
- id : a . id ( ) . required ( ) ,
65
- communityPostPollId : a . id ( ) ,
66
- poll : a . hasOne ( 'CommunityPoll' , 'communityPostPollId' ) ,
67
- metadata : a . ref ( 'CommunityPostMetadata' ) ,
68
- } ) ,
69
- CommunityPoll : a . model ( {
70
- id : a . id ( ) . required ( ) ,
71
- question : a . string ( ) . required ( ) ,
72
- answers : a . hasMany ( 'CommunityPollAnswer' , 'communityPollAnswersId' ) . valueRequired ( )
73
- } ) ,
74
- CommunityPollAnswer : a . model ( {
75
- id : a . id ( ) . required ( ) ,
76
- answer : a . string ( ) . required ( ) ,
77
- communityPollAnswersId : a . id ( ) ,
78
- votes : a . hasMany ( 'CommunityPollVote' , 'communityPollAnswerVotesId' ) . valueRequired ( ) ,
79
- } ) ,
80
- CommunityPollVote : a
81
- . model ( {
82
- id : a . id ( ) . required ( ) ,
83
- communityPollAnswerVotesId : a . id ( )
84
- } )
85
- . authorization ( allow => [ allow . publicApiKey ( ) , allow . owner ( ) ] ) ,
86
- SecondaryIndexModel : a
87
- . model ( {
88
- title : a . string ( ) ,
89
- description : a . string ( ) ,
90
- viewCount : a . integer ( ) ,
91
- status : a . enum ( [ 'draft' , 'pending' , 'published' ] ) ,
92
- } )
93
- . secondaryIndexes ( index => [
94
- index ( 'title' ) ,
95
- index ( 'description' ) . sortKeys ( [ 'viewCount' ] ) ,
96
- ] ) ,
97
- Product : a
98
- . model ( {
99
- sku : a . string ( ) . required ( ) ,
100
- factoryId : a . string ( ) . required ( ) ,
101
- description : a . string ( ) ,
102
- warehouseProductsId : a . id ( ) ,
103
- warehouse : a . belongsTo ( "Warehouse" , 'warehouseProductsId' ) ,
104
- trackingMeta : a . customType ( {
105
- productMeta : a . ref ( 'ProductMeta' ) ,
106
- note : a . string ( ) ,
107
- } ) ,
108
- } )
109
- . identifier ( [ 'sku' , 'factoryId' ] )
110
- . authorization ( allow => [ allow . owner ( ) , allow . publicApiKey ( ) . to ( [ "read" ] ) ] ) ,
111
- Warehouse : a . model ( {
112
- name : a . string ( ) . required ( ) ,
113
- products : a . hasMany ( "Product" , 'warehouseProductsId' ) ,
114
- } ) . authorization ( allow => [ allow . owner ( ) , allow . publicApiKey ( ) . to ( [ "read" ] ) ] ) ,
115
- ProductMeta : a . customType ( {
116
- releaseDate : a . date ( ) ,
117
- status : a . enum ( [ 'in_production' , 'discontinued' ] ) ,
118
- deepMeta : a . customType ( {
119
- content : a . string ( ) ,
120
- } ) ,
121
- } ) ,
122
-
123
- // #region Custom queries and mutations
124
- EchoResult : a . customType ( {
125
- resultContent : a . string ( ) . required ( ) ,
126
- } ) ,
127
-
128
- // custom query returning a non-model type
129
- echo : a
130
- . query ( )
131
- . arguments ( {
132
- argumentContent : a . string ( ) . required ( ) ,
133
- } )
134
- . returns ( a . ref ( 'EchoResult' ) )
135
- . handler ( a . handler . function ( 'echoFunction' ) )
136
- . authorization ( allow => [ allow . publicApiKey ( ) ] ) ,
137
-
138
- // custom query returning a primitive type
139
- echoString : a
140
- . query ( )
141
- . arguments ( {
142
- inputString : a . string ( ) . required ( ) ,
143
- } )
144
- . returns ( a . string ( ) )
145
- . handler ( a . handler . function ( 'echoFunction' ) )
146
- . authorization ( allow => [ allow . publicApiKey ( ) ] ) ,
147
- echoNestedCustomTypes : a
148
- . query ( )
149
- . arguments ( {
150
- input : a . string ( ) . required ( ) ,
151
- } )
152
- . returns ( a . ref ( 'ProductTrackingMeta' ) )
153
- . handler ( a . handler . function ( 'echoFunction' ) )
154
- . authorization ( allow => [ allow . publicApiKey ( ) ] ) ,
155
- echoModelHasNestedTypes : a
156
- . query ( )
157
- . arguments ( {
158
- input : a . string ( ) . required ( ) ,
159
- } )
160
- . returns ( a . ref ( 'Product' ) )
161
- . handler ( a . handler . function ( 'echoFunction' ) )
162
- . authorization ( allow => [ allow . publicApiKey ( ) ] ) ,
163
- // custom mutation returning a non-model type
164
- PostLikeResult : a . customType ( {
165
- likes : a . integer ( ) . required ( ) ,
166
- } ) ,
167
- likePost : a
168
- . mutation ( )
169
- . arguments ( {
170
- postId : a . id ( ) . required ( ) ,
171
- } )
172
- . returns ( a . ref ( 'PostLikeResult' ) )
173
- . handler ( a . handler . function ( 'echoFunction' ) )
174
- . authorization ( allow => [ allow . guest ( ) ] ) ,
175
-
176
- // custom mutation returning a model type
177
- Post : a
178
- . model ( {
179
- id : a . id ( ) . required ( ) ,
180
- content : a . string ( ) ,
181
- comments : a . hasMany ( 'Comment' , 'postCommentsId' ) ,
182
- } )
183
- . authorization ( allow => [ allow . publicApiKey ( ) , allow . owner ( ) ] ) ,
184
- Comment : a
185
- . model ( {
186
- id : a . id ( ) . required ( ) ,
187
- content : a . string ( ) . required ( ) ,
188
- postCommentsId : a . id ( ) . required ( ) ,
189
- post : a . belongsTo ( 'Post' , 'postCommentsId' ) ,
190
- } )
191
- . authorization ( allow => [ allow . publicApiKey ( ) , allow . owner ( ) ] ) ,
192
- likePostReturnPost : a
193
- . mutation ( )
194
- . arguments ( {
195
- postId : a . id ( ) . required ( ) ,
196
- } )
197
- . returns ( a . ref ( 'Post' ) )
198
- . handler ( a . handler . function ( 'echoFunction' ) )
199
- . authorization ( allow => [ allow . guest ( ) ] ) ,
200
-
201
- onPostLiked : a
202
- . subscription ( )
203
- . for ( a . ref ( 'likePostReturnPost' ) )
204
- . handler ( a . handler . custom ( { entry : './jsResolver_base.js' } ) ) ,
205
-
206
- onPostUpdated : a
207
- . subscription ( )
208
- . for ( a . ref ( 'Post' ) . mutations ( [ 'update' ] ) )
209
- . arguments ( { postId : a . string ( ) } )
210
- . handler ( a . handler . custom ( { entry : './jsResolver_base.js' } ) ) ,
211
- //#endregion
212
-
213
- // #region implicit ownership models
214
- ImplicitOwner : a
215
- . model ( {
216
- description : a . string ( ) ,
217
- } )
218
- . authorization ( allow => [ allow . owner ( ) ] ) ,
219
- CustomImplicitOwner : a
220
- . model ( {
221
- description : a . string ( ) ,
222
- } )
223
- . authorization ( allow => [ allow . ownerDefinedIn ( 'customOwner' ) ] ) ,
224
- ModelGroupDefinedIn : a
225
- . model ( {
226
- description : a . string ( ) ,
227
- } )
228
- . authorization ( allow => [ allow . groupDefinedIn ( 'groupField' ) ] ) ,
229
- ModelGroupsDefinedIn : a
230
- . model ( {
231
- description : a . string ( ) ,
232
- } )
233
- . authorization ( allow => [ allow . groupsDefinedIn ( 'groupsField' ) ] ) ,
234
- ModelStaticGroup : a
235
- . model ( {
236
- description : a . string ( ) ,
237
- } )
238
- . authorization ( allow => [ allow . group ( 'Admin' ) ] ) ,
239
- // #endregion
240
27
} ) ;
241
28
242
29
export type Schema = ClientSchema < typeof schema > ;
0 commit comments