-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.js
More file actions
301 lines (283 loc) · 4.71 KB
/
test.js
File metadata and controls
301 lines (283 loc) · 4.71 KB
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
import { gql } from 'apollo-boost';
const users = gql`
{
users{
name
email
address
dob
}
}
`
const addUser = gql`
mutation($name: String!, $email: String!, $password: String!, $dob: String!, $address: String!){
addUser(name: $name, email: $email, password: $password, dob: $dob, address: $address){
name
email
password
}
}
`
const loginQuery = gql`
mutation($email:String!, $password: String!){
login(email:$email, password:$password){
name
email
password
dob
token
}
}
`;
const existingBaseCoordinate = gql`
query($latitude: String!, $longitude: String!){
existingBaseCoordinate(latitude: $latitude, longitude: $longitude){
id
location
userID{
name
email
id
}
}
}
`;
const addBaseReport = gql`
mutation($image: String!, $address: String!, $location: String!, $reportedAt: String!, $reportedOn: String!, $userID: ID!, $noOfReports: Int!){
addBaseReport(image: $image, address: $address, location: $location, reportedAt: $reportedAt, reportedOn: $reportedOn, userID: $userID, noOfReports: $noOfReports){
id
location
userID{
id
name
email
}
}
}
`;
const addReport = gql`
mutation($image: String!, $address: String!, $location: String!, $reportedAt: String!, $reportedOn: String!, $userID: ID!, $baseParent: ID!, $karma: Int!){
addReport(image: $image, address: $address, location: $location, reportedAt: $reportedAt, reportedOn: $reportedOn, userID: $userID, baseParent: $baseParent, karma: $karma){
id
location
userID{
id
name
email
}
baseParent{
id
location
userID{
id
name
email
}
}
}
}
`;
const decrypt = gql`
query($token: String){
decrypt(token: $token){
name
email
id
karma
reports {
reportedAt
reportedOn
}
}
}
`
const decryptAdvertiser = gql`
query($token: String){
decryptAdvertiser(token: $token){
company
email
id
website
category
advertisments{
id
title
image
link
screentime
outreach
}
coupons{
id
name
validity
amount
}
}
}
`
const addAdvertiser = gql`
mutation($company: String!, $email: String!, $password: String!, $website: String!, $category: String!){
addAdvertiser(company: $company, email: $email, password: $password, website: $website, category: $category){
email
company
website
category
}
}
`
const loginAdvertiser = gql`
mutation($email:String!, $password: String!){
loginAdvertiser(email:$email, password:$password){
email
company
website
category
token
}
}
`
const allBaseReports = gql`
{
allBaseReports{
id
location
noOfReports
userID{
name
id
email
}
similar{
id
reportedAt
reportedOn
location
userID{
name
id
email
}
address
}
}
}
`
const findUsingZipCode = gql`
query($zip:String!) {
findUsingZipCode(zip: $zip) {
id
location
similar{
id
reportedAt
reportedOn
location
userID{
name
id
email
}
address
}
}
}
`
const isOnLine = gql`
mutation($encoded: [String]){
isOnLine(encoded: $encoded){
location
}
}
`
const allAdvertisers = gql`
{
allAdvertisers{
id
email
company
website
coupons{
id
name
amount
validity
assigned
userID{
email
name
id
}
}
advertisments{
id
title
link
screentime
outreach
when
}
}
}
`
const addAdvertisment = gql`
mutation($title: String!, $link: String!, $image: String!, $when: String!, $advertiserID: ID!){
addAdvertisment(title: $title, link: $link, image: $image, when: $when, advertiserID: $advertiserID){
title
link
image
when
}
}
`
const allMyAds = gql`
query($token: String!){
allMyAds(token: $token){
title
link
image
screentime
when
outreach
}
}
`
const addCoupon = gql`
mutation($name: String!, $amount: String!, $validity: String!, $advertiserID: ID!){
addCoupon(name: $name, amount: $amount, validity: $validity, advertiserID: $advertiserID){
name
amount
validity
assigned
advertiserID{
company
email
id
}
userID{
name
email
id
}
}
}
`
export {
users,
addUser,
loginQuery,
existingBaseCoordinate,
addBaseReport,
addReport,
decrypt,
addAdvertiser,
loginAdvertiser,
decryptAdvertiser,
allBaseReports,
findUsingZipCode,
isOnLine,
allAdvertisers,
addAdvertisment,
allMyAds,
addCoupon
};