-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathschema.js
1074 lines (1029 loc) · 17.8 KB
/
schema.js
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
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
const { gql } = require("apollo-server");
module.exports = gql`
directive @requiresLogin on FIELD_DEFINITION
directive @requiresAdmin on FIELD_DEFINITION
directive @requiresSupport on FIELD_DEFINITION
directive @requiresOwnership on FIELD_DEFINITION
type Query {
"""
Get all users (Requires Admin Access)
"""
users: [User]
me: User
listings(id: ID, uuid: String, title: String): [Listing] @requiresLogin
currencies: [Currency]
countryByCode(countryCode: String): Country
countries(
name: String
currencyCode: CurrencyCode
continentCode: ContinentCode
continent: String
currencyCode: CurrencyCode
): [Country]
currencyCodes: [CurrencyCode]
countryCodes: [CountryCode]
statesByCountry(countryCode: CountryCode!): [State]
stateByCode(countryCode: String, stateCode: String): State
stateAddRequests(searchText: String): [StateAddRequest]
citiesByState(countryCode: CountryCode!, stateCode: String!): [City]
cityAddRequests(searchText: String): [CityAddRequest]
continentCodes: [ContinentCode]
currencyDetails(code: CurrencyCode): Currency
amenities(searchText: String): [ListingAmenity]
amenityCategories: [ListingAmenityCategory]
houseRules(searchText: String): [HouseRule]
hobbies(title: String, description: String, emoticon: String, searchText: String): [Hobby]
files: [File!]
}
type Mutation {
"""
Mutation to Signup Users
"""
signUp(credentials: UserInput): AuthPayload
"""
User sign in with username (or email) and password
"""
signIn(credentials: Credentials!): AuthPayload
deleteUser(userUUID: String!): User
signOut: AuthPayload
"""
Update Core user details - email, username, dob, gender - required login or ADMIN role
If user email changed, sets email verification status to false and sends verification token to new email address
"""
updateUser(userUUID: String!, updateData: UserUpdateInput): User
"""
Update User profile details (firstname, lastname, hobbies etc)
User must be logged in or have ADMIN role
"""
updateUserProfile(userUUID: String, updateData: ProfileInput): User
addListing(listing: ListingInput): Listing @requiresLogin
updateListing(listingUUID: String, updateData: ListingInput): Listing
@requiresLogin
deleteListing(listingUUID: String): Listing @requiresLogin
toggleListingPublishedStatus(listingUUID: String): Listing @requiresLogin
addOrUpdateAmenityCategory(
categoryData: ListingAmenityCategoryInput
): ListingAmenityCategory
deleteAmenityCategory(categoryId: Int): ListingAmenityCategory
addOrUpdateAmenity(amenityData: ListingAmenityInput): ListingAmenity
deleteAmenity(amenityId: Int): ListingAmenity
addOrUpdateHouseRule(houseRuleData: HouseRuleInput): HouseRule
deleteHouseRule(houseRuleId: Int): HouseRule
"""
Add or Update Hobbies (include ID (id) field to update, exclude to create)
"""
addOrUpdateHobby(hobby: HobbyInput): Hobby
deleteHobby(hobbyId: Int): Hobby
uploadFile(file: Upload!): File
setListingFeaturedImage(file: Upload!, listingUUID: String!, title: String, description: String): ListingImage @requiresLogin
addListingImage(file:Upload!, listingUUID: String!, title: String, description: String): ListingImage @requiresLogin
addOrUpdateStateRequest(stateData: StateAddRequestInput): StateAddRequest
addOrUpdateCityRequest(cityData: CityAddRequestInput): CityAddRequest
deleteStateAddRequest(stateAddRequestId: ID): StateAddRequest
deleteCityAddRequest(cityAddRequestId: ID): CityAddRequest
updateListingImageInfo(imageUUID: String, title: String, description: String): ListingImage @requiresLogin
deleteListingImage(listingUUID: String!, imageUUID: String): [ListingImage]
}
type ImageFile {
id: ID!
uuid: String
filename: String
filePath: String
fileURL: String
thumbnailPath: String
thumbnailURL: String
mediumPath: String
mediumURL: String
largePath: String
largeURL: String
}
type File {
id: ID!
filename: String!
mimetype: String!
path: String!
}
type Subscription {
userLoggedIn: User
userSignedUp: User
hobbyAdded: Hobby
amenityAdded: ListingAmenity
amenityCategoryAdded: ListingAmenityCategory
houseRuleAdded: HouseRule
listingAdded: Listing
cityAddRequestAdded: CityAddRequest
stateAddRequestAdded: StateAddRequest
}
"""
Base User ObjectType
"""
type User {
id: ID
uuid: String
email: String
emailIsVerified: Boolean
emailVerificationToken: String
"""
Date of Birth in format 'YYYY-MM-DD' - Must be above 18yrs to signup
"""
dob: String
"""
Terms of Service Acceptance - Must be true to signup
"""
tos: Boolean
"""
User gender - Can be 'male', 'female', or 'prefer not to say'
"""
gender: String
"""
Username - Unique Identifier for signup + login
"""
username: String
"""
Roles - Enum for access control
"""
roles: [Role]
profile: Profile
agentProfile: Agent
isOnline: Boolean
lastSeen: String
lastLogin: String
listings: [Listing]
bookings: [Booking]
supportProfile: Support
createdAt: String
updatedAt: String
}
input UserUpdateInput {
email: String
username: String
dob: String
gender: String
}
input ProfileInput {
uuid: String
firstname: String
lastname: String
phone: String
bio: String
hobbies: [HobbyInput]
instagramHandle: String
twitterHandle: String
snapchatUrl: String
facebookUrl: String
websiteUrl: String
}
type Hobby {
id: ID
uuid: String
title: String
description: String
emoticon: String
profiles: [Profile]
}
input HobbyInput {
id: ID
title: String!
description: String!
emoticon: String!
}
"""
Basic Profile for User Object
"""
type Profile {
id: ID
uuid: String
profileImageUrl: String
profileImagePath: String
identityCardImageUrl: String
identityVerified: Boolean
IdentityVerifiedById: Int
IdentityVerifiedAt: String
firstname: String
lastname: String
phone: String
phoneIsVerified: Boolean
bio: String
instagramHandle: String
twitterHandle: String
snapchatUrl: String
facebookUrl: String
websiteUrl: String
user: User
userId: Int
hobbies: [Hobby]
createdAt: String
updatedAt: String
}
"""
Required Info for User signup
"""
input UserInput {
email: String!
"""
Date of birth in format "YYYY-MM-DD". Must be above 18yrs to sign up
"""
dob: String!
"""
Terms of Service acceptance - Must be true to to signup
"""
tos: Boolean!
gender: String!
username: String!
password: String!
}
"""
Required Info for Agent Status request
"""
input AgentInput {
userId: Int
agentEmail: String
agentPhone: String
}
"""
Details of Users with "Agent" Role
"""
type Agent {
id: ID
uuid: String
company: Company
companyId: Int
licenseUrl: String
licenseIsImage: Boolean
licenseIsUpload: Boolean
licenseFilePath: String
approved: Boolean
approvedAt: String
approvedBy: Support
approvedById: Int
user: User
userId: Int
agentEmail: String
agentPhone: String
agentEmailIsVerified: Boolean
agentPhoneIsVerified: Boolean
rentals: [Rental]
createdAt: String
updatedAt: String
}
"""
Details of Companies that agents work with
"""
type Company {
id: ID
uuid: String
email: String
name: String
websiteUrl: String
address: String
locationCity: String
locationState: String
locationCountry: String
phone: String
agents: [Agent]
createdAt: String
updatedAt: String
}
"""
Rentals posted by Agents
"""
type Rental {
id: ID
uuid: String
isPublished: Boolean
title: String
shortDesc: String
agent: Agent
agentId: Int
images: [RentalImage]
createdAt: String
updatedAt: String
}
"""
Details of Images for Rentals
"""
type RentalImage {
id: ID
imageIndex: Int
uuid: String
imageResizedUrl: String
imageFullsizeUrl: String
imageResizedPath: String
imageFullSizedPath: String
rental: Rental
rentalId: Int
createdAt: String
updatedAt: String
}
"""
Details of Users with "Support" Role
"""
type Support {
id: ID!
uuid: String
agentApprovals: [Agent]
profileVerifications: [Profile]
userData: User
userDataId: Int
createdAt: String
updatedAt: String
}
"""
Details of Listings posted by Users
"""
type Listing {
id: ID!
uuid: String
title: String
shortDescription: String
longDescription: String
additionalRules: [String]
guestsShouldKnow: [GuestsShouldKnowInfo]
houseRules: [hasHouseRule]
baseCurrency: Currency
basicPrice(currency: CurrencyCode!): Float
pricePerWeekend(currency: CurrencyCode!): Float
pricePerWeek(currency: CurrencyCode!): Float
pricePerMonth(currency: CurrencyCode!): Float
guestCapacity: Int
noOfBedrooms: Int
noOfBathrooms: Int
idealForSleeping: Boolean
beds: [Bed]
guestArrivalDaysNotice: Int
guestBookingMonthsInAdvance: Int
bookingStayDaysMin: Int
bookingStayDaysMax: Int
locationCountry: Country
locationState: State
locationCity: City
streetAddress: String
latitude: Float
longitude: Float
listingPurpose: String
listingType: String
listingKind: String
listingKindCode: String
listingSubgroup: String
amenities: [ListingAmenity]
allowedSpaces: [String]
specialFeatures: [String]
guestPreferences: [String]
isPublished: Boolean
owner: User
ownerId: Int
featuredImage: ListingImage
images: [ListingImage]
bookings: [Booking]
createdAt: String
updatedAt: String
requestedCurrency(currency: CurrencyCode!): Currency
}
input ListingInput {
title: String
shortDescription: String
longDescription: String
additionalRules: [String]
guestsShouldKnow: [GuestsShouldKnowInfoInput]
baseCurrency: CurrencyCode
basicPrice: Float
pricePerWeekend: Float
pricePerWeek: Float
pricePerMonth: Float
guestCapacity: Int
guestArrivalDaysNotice: Int
noOfBedrooms: Int
noOfBathrooms: Int
idealForSleeping: Boolean
beds: [BedInput]
guestBookingMonthsInAdvance: Int
bookingStayDaysMin: Int
bookingStayDaysMax: Int
locationCountry: CountryCode
locationState: String
locationCity: String
streetAddress: String
listingPurpose: ListingPurpose
listingType: ListingType
listingKind: String
listingKindCode: String
listingSubgroup: String
latitude: Float
longitude: Float
houseRules: [hasHouseRuleInput]
amenities: [Int]
allowedSpaces: [String]
specialFeatures: [String]
guestPreferences: [String]
}
type GuestsShouldKnowInfo {
id: ID
info: String
title: String
description: String
}
input GuestsShouldKnowInfoInput {
id: ID
info: String
title: String
description: String
}
type Bed {
type: String
quantity: Int
}
input BedInput {
type: String
quantity: Int
}
type ListingAmenity {
id: ID
uuid: String
title: String
description: String
faIcon: String
mdiIcon: String
category: ListingAmenityCategory
}
input ListingAmenityInput {
id: ID
title: String
description: String
faIcon: String
mdiIcon: String
categoryId: ID
}
type ListingAmenityCategory {
id: ID
uuid: String
title: String
description: String
amenities: [ListingAmenity]
createdAt: String
updatedAt: String
}
input ListingAmenityCategoryInput {
id: ID
title: String
description: String
}
type hasHouseRule {
isAllowed: Boolean
rule: HouseRule
}
input hasHouseRuleInput {
isAllowed: Boolean
ruleId: Int
}
type HouseRule {
id: ID
uuid: String
title: String
description: String
code: String
faIconTrue: String
faIconFalse: String
mdiIconTrue: String
mdiIconFalse: String
}
input HouseRuleInput {
id: ID
title: String
description: String
code: String
faIconTrue: String
faIconFalse: String
mdiIconTrue: String
mdiIconFalse: String
}
"""
Details of Images associated with posted Listings
"""
type ListingImage {
title: String
description: String
index: Int
image: ImageFile
}
"""
Details of Bookings made by "Users"
"""
type Booking {
id: ID!
uuid: String
listing: Listing
listingId: Int
guest: User
guestId: Int
createdAt: String
updatedAt: String
}
input Credentials {
email: String
password: String
username: String
}
type AuthPayload {
token: String
user: User
}
type Currency {
symbol: String
name: String
pluralName: String
nativeSymbol: String
code: CurrencyCode
decimalDigits: Int
rounding: Float
}
type Country {
tld: String
name: String
countryCode: CountryCode
continent: String
continentCode: ContinentCode
capital: String
currencyCode: CurrencyCode
currency: Currency
latitude: Float
longitude: Float
emoji: String
emojiU: String
phoneCode: String
states: [State]
subregion: String
}
type State {
name: String
stateCode: String
countryCode: CountryCode
countryName: String
latitude: Float
longitude: Float
cities: [City]
}
type StateAddRequest {
id: ID
uuid: String
name: String
stateCode: String
countryCode: CountryCode
countryName: String
latitude: Float
longitude: Float
addedToData: Boolean
}
input StateAddRequestInput {
id: ID
name: String
stateCode: String
countryCode: CountryCode
countryName: String
latitude: Float
longitude: Float
addedToData: Boolean
}
type City {
name: String
stateCode: String
stateName: String
countryCode: CountryCode
countryName: String
latitude: Float
longitude: Float
addedToData: Boolean
}
type CityAddRequest{
id: ID
uuid: String
name: String
stateCode: String
stateName: String
countryCode: CountryCode
countryName: String
latitude: Float
longitude: Float
addedToData: Boolean
}
input CityAddRequestInput{
id: ID
name: String
stateCode: String
stateName: String
countryCode: CountryCode
countryName: String
latitude: Float
longitude: Float
addedToData: Boolean
}
"""
Possible Roles available to users - Users can have multiple roles
"""
enum Role {
USER
AGENT
SUPPORT
ADMIN
}
enum ListingPurpose {
RESIDENTIAL
COMMERCIAL
EVENTS
ANY
}
enum ListingType {
ENTIRE_PLACE
PRIVATE_ROOM
SHARED_ROOM
}
enum ContinentCode {
AS
EU
AN
AF
OC
NA
SA
}
enum CountryCode {
BD
BE
BF
BG
BA
BB
WF
BL
BN
BO
BH
BI
BJ
JM
BV
BW
WS
BQ
BR
BS
JE
BY
BZ
RU
RW
RS
TL
RE
TM
TJ
RO
TK
GW
GU
GT
GS
GR
GQ
GP
JP
GY
GG
GF
GE
GD
GB
GA
SV
GN
GM
GL
GI
GH
OM
TN
JO
HR
HT
HU
HK
HN
HM
PR
PS
PW
PT
SJ
PY
IQ
PA
PF
PG
PE
PK
PH
PN
PL
PM
EH
EE
EG
ZA
EC
IT
VN
SB
ET
SO
SA
ES
ER
ME
MD
MG
MF
MA
MC
UZ
MM
ML
MO
MN
MH
MK
MU
MT
MW
MQ
MP
MS
IM
UG
TZ
MY
MX
IL
FR
IO
SH
FI
FJ
FK
FM
FO
NI
NL
NO
NA
VU
NC
NE
NF
NG
NZ
NP
NR
NU
CK
XK
CI
CH
CO
CN
CM
CL
CC
CA
CG
CF
CD
CZ
CY
CX
CR
CV
SY
KE
SR
KI
KH
KN
KM
SK
KR
SI
KW
SN
SM
SL
KZ
KY
SG
SE
SD
DO
DM
DJ
DK
VG
DE
YE
DZ
US
UY
YT
UM
LB
LC
TV
TW
TT
TR
LK
LI
LV
TO
LT
LU
LR
TH
TF
TG
TD
TC
LY
VA
VC
AE
AD
AG
AF
AI
VI
IS
IR
AM
AL
AO
AS
AR
AU
AT
AW
IN
AX
AZ
IE
ID
UA
QA
MZ
}
enum CurrencyCode {
USD
AED
AFN
ALL
AMD
AOA
ARS
AUD
AWG
AZN
BAM
BBD
BDT
BGN
BHD
BIF
BND
BOB
BRL
BSD
BWP
BYR
BZD
CAD
CDF
CHF
CLP
CNY
COP
CRC
CVE
CZK
DJF
DKK
DOP
DZD
EEK
EGP
ERN
ETB
EUR
FJD
FKP
GBP
GEL
GHS
GIP
GMD
GNF
GTQ
GYD
HKD
HNL
HRK
HTG
HUF
IDR
ILS
INR
IQD
IRR
ISK
JMD
JOD
JPY
KES
KHR
KMF
KRW
KWD
KYD
KZT
LBP
LKR