@vertikalx/vtx-backend-client 1.0.0-preprod.2 → 1.0.0-preprod.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/api/vtx-base-api.d.ts +36 -1
- package/src/api/vtx-base-api.js +2397 -2
- package/src/api/vtx-base-api.js.map +1 -1
- package/src/client/schema.d.ts +1057 -28
- package/src/client/schema.js +213 -9
- package/src/client/schema.js.map +1 -1
- package/src/client/types.d.ts +534 -17
- package/src/client/types.js +1758 -388
- package/src/client/types.js.map +1 -1
- package/tsconfig.lib.tsbuildinfo +1 -1
- package/src/client/schema.graphql +0 -1439
package/src/api/vtx-base-api.js
CHANGED
|
@@ -12,6 +12,9 @@ class VTXBaseAPI {
|
|
|
12
12
|
this.headers = headers ?? api_call_headers_1.DEFAULT_HEADERS;
|
|
13
13
|
this.backendUrl = backendUrl ?? VTXBaseAPI.getDefaultBackendUrl();
|
|
14
14
|
}
|
|
15
|
+
getHeaders() {
|
|
16
|
+
return this.headers;
|
|
17
|
+
}
|
|
15
18
|
setHeader(key, value) {
|
|
16
19
|
this.headers[key] = value;
|
|
17
20
|
}
|
|
@@ -1785,6 +1788,74 @@ class VTXBaseAPI {
|
|
|
1785
1788
|
}
|
|
1786
1789
|
return retValue;
|
|
1787
1790
|
}
|
|
1791
|
+
async getStates() {
|
|
1792
|
+
const client = (0, client_1.createClient)({
|
|
1793
|
+
url: this.backendUrl + "/graphql",
|
|
1794
|
+
headers: this.headers,
|
|
1795
|
+
});
|
|
1796
|
+
const fields = {
|
|
1797
|
+
_id: true,
|
|
1798
|
+
name: true,
|
|
1799
|
+
country: {
|
|
1800
|
+
_id: true,
|
|
1801
|
+
name: true
|
|
1802
|
+
}
|
|
1803
|
+
};
|
|
1804
|
+
let retValue;
|
|
1805
|
+
try {
|
|
1806
|
+
const response = await client.query({
|
|
1807
|
+
getStates: {
|
|
1808
|
+
__args: {},
|
|
1809
|
+
...fields
|
|
1810
|
+
}
|
|
1811
|
+
});
|
|
1812
|
+
VTXBaseAPI.Logger.debug('getStates Response:');
|
|
1813
|
+
VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
|
|
1814
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'getStates', (r) => {
|
|
1815
|
+
VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
|
|
1816
|
+
const isResponseOk = true && Array.isArray(response?.getStates);
|
|
1817
|
+
return isResponseOk;
|
|
1818
|
+
});
|
|
1819
|
+
}
|
|
1820
|
+
catch (err1) {
|
|
1821
|
+
VTXBaseAPI.Logger.error('getStates err1:');
|
|
1822
|
+
VTXBaseAPI.Logger.error(err1);
|
|
1823
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
1824
|
+
}
|
|
1825
|
+
return retValue;
|
|
1826
|
+
}
|
|
1827
|
+
async getCountries() {
|
|
1828
|
+
const client = (0, client_1.createClient)({
|
|
1829
|
+
url: this.backendUrl + "/graphql",
|
|
1830
|
+
headers: this.headers,
|
|
1831
|
+
});
|
|
1832
|
+
let retValue;
|
|
1833
|
+
const fields = {
|
|
1834
|
+
_id: true,
|
|
1835
|
+
name: true,
|
|
1836
|
+
};
|
|
1837
|
+
try {
|
|
1838
|
+
const response = await client.query({
|
|
1839
|
+
getCountries: {
|
|
1840
|
+
__args: {},
|
|
1841
|
+
...fields
|
|
1842
|
+
}
|
|
1843
|
+
});
|
|
1844
|
+
VTXBaseAPI.Logger.debug('getCountries Response:');
|
|
1845
|
+
VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
|
|
1846
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'getCountries', (r) => {
|
|
1847
|
+
VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
|
|
1848
|
+
const isResponseOk = true && Array.isArray(response?.getCountries);
|
|
1849
|
+
return isResponseOk;
|
|
1850
|
+
});
|
|
1851
|
+
}
|
|
1852
|
+
catch (err1) {
|
|
1853
|
+
VTXBaseAPI.Logger.error('getCountries err1:');
|
|
1854
|
+
VTXBaseAPI.Logger.error(err1);
|
|
1855
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
1856
|
+
}
|
|
1857
|
+
return retValue;
|
|
1858
|
+
}
|
|
1788
1859
|
async loginUserFromCredentialsVtx(username, password) {
|
|
1789
1860
|
const client = (0, client_1.createClient)({
|
|
1790
1861
|
url: this.backendUrl + '/graphql',
|
|
@@ -2104,6 +2175,29 @@ class VTXBaseAPI {
|
|
|
2104
2175
|
resultWebLink: true
|
|
2105
2176
|
}
|
|
2106
2177
|
},
|
|
2178
|
+
affiliations: {
|
|
2179
|
+
_id: true,
|
|
2180
|
+
organization: {
|
|
2181
|
+
_id: true,
|
|
2182
|
+
shortName: true,
|
|
2183
|
+
acronym: true,
|
|
2184
|
+
fullName: true,
|
|
2185
|
+
website: true,
|
|
2186
|
+
logo: {
|
|
2187
|
+
_id: true,
|
|
2188
|
+
name: true,
|
|
2189
|
+
contentType: true,
|
|
2190
|
+
size: true,
|
|
2191
|
+
useType: true,
|
|
2192
|
+
url: true,
|
|
2193
|
+
key: true
|
|
2194
|
+
}
|
|
2195
|
+
},
|
|
2196
|
+
membershipNumber: true,
|
|
2197
|
+
membershipType: true,
|
|
2198
|
+
issueDate: true,
|
|
2199
|
+
expirationDate: true,
|
|
2200
|
+
},
|
|
2107
2201
|
totalUpcomingCompetitions: true,
|
|
2108
2202
|
totalPastCompetitions: true,
|
|
2109
2203
|
profilePicture: {
|
|
@@ -2124,9 +2218,23 @@ class VTXBaseAPI {
|
|
|
2124
2218
|
url: true,
|
|
2125
2219
|
key: true
|
|
2126
2220
|
},
|
|
2221
|
+
bannerPicture: {
|
|
2222
|
+
_id: true,
|
|
2223
|
+
name: true,
|
|
2224
|
+
contentType: true,
|
|
2225
|
+
size: true,
|
|
2226
|
+
useType: true,
|
|
2227
|
+
url: true,
|
|
2228
|
+
key: true
|
|
2229
|
+
},
|
|
2127
2230
|
preferences: {
|
|
2128
2231
|
_id: true,
|
|
2129
|
-
showProfileHelper: true
|
|
2232
|
+
showProfileHelper: true,
|
|
2233
|
+
defaultAlbum: {
|
|
2234
|
+
_id: true,
|
|
2235
|
+
label: true,
|
|
2236
|
+
description: true,
|
|
2237
|
+
}
|
|
2130
2238
|
},
|
|
2131
2239
|
currentCampaign: {
|
|
2132
2240
|
_id: true,
|
|
@@ -2237,6 +2345,112 @@ class VTXBaseAPI {
|
|
|
2237
2345
|
resultWebLink: true
|
|
2238
2346
|
}
|
|
2239
2347
|
}
|
|
2348
|
+
},
|
|
2349
|
+
stripeAccountReference: {
|
|
2350
|
+
_id: true,
|
|
2351
|
+
stripeAccountId: true,
|
|
2352
|
+
account: {
|
|
2353
|
+
id: true,
|
|
2354
|
+
object: true,
|
|
2355
|
+
business_type: true,
|
|
2356
|
+
country: true,
|
|
2357
|
+
email: true,
|
|
2358
|
+
capabilities: {
|
|
2359
|
+
acss_debit_payments: true,
|
|
2360
|
+
affirm_payments: true,
|
|
2361
|
+
afterpay_clearpay_payments: true,
|
|
2362
|
+
alma_payments: true,
|
|
2363
|
+
amazon_pay_payments: true,
|
|
2364
|
+
au_becs_debit_payments: true,
|
|
2365
|
+
bacs_debit_payments: true,
|
|
2366
|
+
bancontact_payments: true,
|
|
2367
|
+
bank_transfer_payments: true,
|
|
2368
|
+
blik_payments: true,
|
|
2369
|
+
boleto_payments: true,
|
|
2370
|
+
card_issuing: true,
|
|
2371
|
+
card_payments: true,
|
|
2372
|
+
cartes_bancaires_payments: true,
|
|
2373
|
+
cashapp_payments: true,
|
|
2374
|
+
eps_payments: true,
|
|
2375
|
+
fpx_payments: true,
|
|
2376
|
+
gb_bank_transfer_payments: true,
|
|
2377
|
+
giropay_payments: true,
|
|
2378
|
+
grabpay_payments: true,
|
|
2379
|
+
ideal_payments: true,
|
|
2380
|
+
india_international_payments: true,
|
|
2381
|
+
jcb_payments: true,
|
|
2382
|
+
jp_bank_transfer_payments: true,
|
|
2383
|
+
kakao_pay_payments: true,
|
|
2384
|
+
klarna_payments: true,
|
|
2385
|
+
konbini_payments: true,
|
|
2386
|
+
kr_card_payments: true,
|
|
2387
|
+
legacy_payments: true,
|
|
2388
|
+
link_payments: true,
|
|
2389
|
+
mobilepay_payments: true,
|
|
2390
|
+
multibanco_payments: true,
|
|
2391
|
+
mx_bank_transfer_payments: true,
|
|
2392
|
+
naver_pay_payments: true,
|
|
2393
|
+
oxxo_payments: true,
|
|
2394
|
+
p24_payments: true,
|
|
2395
|
+
pay_by_bank_payments: true,
|
|
2396
|
+
payco_payments: true,
|
|
2397
|
+
paynow_payments: true,
|
|
2398
|
+
promptpay_payments: true,
|
|
2399
|
+
revolut_pay_payments: true,
|
|
2400
|
+
samsung_pay_payments: true,
|
|
2401
|
+
sepa_bank_transfer_payments: true,
|
|
2402
|
+
sepa_debit_payments: true,
|
|
2403
|
+
sofort_payments: true,
|
|
2404
|
+
swish_payments: true,
|
|
2405
|
+
tax_reporting_us_1099_k: true,
|
|
2406
|
+
tax_reporting_us_1099_misc: true,
|
|
2407
|
+
transfers: true,
|
|
2408
|
+
treasury: true,
|
|
2409
|
+
twint_payments: true,
|
|
2410
|
+
us_bank_account_ach_payments: true,
|
|
2411
|
+
us_bank_transfer_payments: true,
|
|
2412
|
+
zip_payments: true
|
|
2413
|
+
},
|
|
2414
|
+
requirements: {
|
|
2415
|
+
alternatives: {
|
|
2416
|
+
alternative_fields_due: true,
|
|
2417
|
+
original_fields_due: true
|
|
2418
|
+
},
|
|
2419
|
+
current_deadline: true,
|
|
2420
|
+
currently_due: true,
|
|
2421
|
+
disabled_reason: true,
|
|
2422
|
+
errors: {
|
|
2423
|
+
code: true,
|
|
2424
|
+
reason: true,
|
|
2425
|
+
requirement: true
|
|
2426
|
+
},
|
|
2427
|
+
eventually_due: true,
|
|
2428
|
+
past_due: true,
|
|
2429
|
+
pending_verification: true
|
|
2430
|
+
},
|
|
2431
|
+
future_requirements: {
|
|
2432
|
+
alternatives: {
|
|
2433
|
+
alternative_fields_due: true,
|
|
2434
|
+
original_fields_due: true
|
|
2435
|
+
},
|
|
2436
|
+
current_deadline: true,
|
|
2437
|
+
currently_due: true,
|
|
2438
|
+
disabled_reason: true,
|
|
2439
|
+
errors: {
|
|
2440
|
+
code: true,
|
|
2441
|
+
reason: true,
|
|
2442
|
+
requirement: true
|
|
2443
|
+
},
|
|
2444
|
+
eventually_due: true,
|
|
2445
|
+
past_due: true,
|
|
2446
|
+
pending_verification: true
|
|
2447
|
+
},
|
|
2448
|
+
type: true,
|
|
2449
|
+
charges_enabled: true,
|
|
2450
|
+
payouts_enabled: true,
|
|
2451
|
+
created: true,
|
|
2452
|
+
default_currency: true
|
|
2453
|
+
}
|
|
2240
2454
|
}
|
|
2241
2455
|
};
|
|
2242
2456
|
try {
|
|
@@ -4059,6 +4273,7 @@ class VTXBaseAPI {
|
|
|
4059
4273
|
fundsRequired: true,
|
|
4060
4274
|
initialFundsObtained: true,
|
|
4061
4275
|
fundsObtained: true,
|
|
4276
|
+
vtxComissionPct: true,
|
|
4062
4277
|
location: {
|
|
4063
4278
|
userProvidedLatitude: true,
|
|
4064
4279
|
userProvidedLongitude: true,
|
|
@@ -4275,7 +4490,7 @@ class VTXBaseAPI {
|
|
|
4275
4490
|
headers: this.headers,
|
|
4276
4491
|
});
|
|
4277
4492
|
const fields = desiredFields ?? { _id: true };
|
|
4278
|
-
let retValue;
|
|
4493
|
+
let retValue = {};
|
|
4279
4494
|
try {
|
|
4280
4495
|
const response = await client.mutation({
|
|
4281
4496
|
createAthleteMembershipAffilation: {
|
|
@@ -4300,6 +4515,44 @@ class VTXBaseAPI {
|
|
|
4300
4515
|
}
|
|
4301
4516
|
return retValue;
|
|
4302
4517
|
}
|
|
4518
|
+
async deleteMembershipAffiliation(dto) {
|
|
4519
|
+
const client = (0, client_1.createClient)({
|
|
4520
|
+
url: this.backendUrl + "/graphql",
|
|
4521
|
+
headers: this.headers,
|
|
4522
|
+
});
|
|
4523
|
+
const fields = {
|
|
4524
|
+
idToDelete: true,
|
|
4525
|
+
deleted: true,
|
|
4526
|
+
failureReason: {
|
|
4527
|
+
code: true,
|
|
4528
|
+
message: true
|
|
4529
|
+
}
|
|
4530
|
+
};
|
|
4531
|
+
let retValue = {};
|
|
4532
|
+
try {
|
|
4533
|
+
const response = await client.mutation({
|
|
4534
|
+
deleteAthleteMembershipAffilation: {
|
|
4535
|
+
__args: {
|
|
4536
|
+
input: dto
|
|
4537
|
+
},
|
|
4538
|
+
...fields
|
|
4539
|
+
}
|
|
4540
|
+
});
|
|
4541
|
+
VTXBaseAPI.Logger.debug('deleteAthleteMembershipAffilation Response:');
|
|
4542
|
+
VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
|
|
4543
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'deleteAthleteMembershipAffilation', (r) => {
|
|
4544
|
+
VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
|
|
4545
|
+
const isResponseOk = true && response?.deleteAthleteMembershipAffilation?.idToDelete;
|
|
4546
|
+
return isResponseOk;
|
|
4547
|
+
});
|
|
4548
|
+
}
|
|
4549
|
+
catch (error1) {
|
|
4550
|
+
VTXBaseAPI.Logger.error('deleteAthleteMembershipAffilation err1:');
|
|
4551
|
+
VTXBaseAPI.Logger.error(error1);
|
|
4552
|
+
retValue = (0, response_builder_1.buildErrorResponse)(error1);
|
|
4553
|
+
}
|
|
4554
|
+
return retValue;
|
|
4555
|
+
}
|
|
4303
4556
|
async queryAthleteFundingCampaigns(dto) {
|
|
4304
4557
|
const client = (0, client_1.createClient)({
|
|
4305
4558
|
url: this.backendUrl + "/graphql",
|
|
@@ -4591,6 +4844,2148 @@ class VTXBaseAPI {
|
|
|
4591
4844
|
}
|
|
4592
4845
|
return retValue;
|
|
4593
4846
|
}
|
|
4847
|
+
async createStripeAccount(dto, desiredFields) {
|
|
4848
|
+
const client = (0, client_1.createClient)({
|
|
4849
|
+
url: this.backendUrl + "/graphql",
|
|
4850
|
+
headers: this.headers,
|
|
4851
|
+
});
|
|
4852
|
+
const fields = desiredFields ?? {
|
|
4853
|
+
_id: true,
|
|
4854
|
+
stripeAccountId: true,
|
|
4855
|
+
account: {
|
|
4856
|
+
id: true,
|
|
4857
|
+
object: true,
|
|
4858
|
+
business_type: true,
|
|
4859
|
+
country: true,
|
|
4860
|
+
email: true,
|
|
4861
|
+
capabilities: {
|
|
4862
|
+
acss_debit_payments: true,
|
|
4863
|
+
affirm_payments: true,
|
|
4864
|
+
afterpay_clearpay_payments: true,
|
|
4865
|
+
alma_payments: true,
|
|
4866
|
+
amazon_pay_payments: true,
|
|
4867
|
+
au_becs_debit_payments: true,
|
|
4868
|
+
bacs_debit_payments: true,
|
|
4869
|
+
bancontact_payments: true,
|
|
4870
|
+
bank_transfer_payments: true,
|
|
4871
|
+
blik_payments: true,
|
|
4872
|
+
boleto_payments: true,
|
|
4873
|
+
card_issuing: true,
|
|
4874
|
+
card_payments: true,
|
|
4875
|
+
cartes_bancaires_payments: true,
|
|
4876
|
+
cashapp_payments: true,
|
|
4877
|
+
eps_payments: true,
|
|
4878
|
+
fpx_payments: true,
|
|
4879
|
+
gb_bank_transfer_payments: true,
|
|
4880
|
+
giropay_payments: true,
|
|
4881
|
+
grabpay_payments: true,
|
|
4882
|
+
ideal_payments: true,
|
|
4883
|
+
india_international_payments: true,
|
|
4884
|
+
jcb_payments: true,
|
|
4885
|
+
jp_bank_transfer_payments: true,
|
|
4886
|
+
kakao_pay_payments: true,
|
|
4887
|
+
klarna_payments: true,
|
|
4888
|
+
konbini_payments: true,
|
|
4889
|
+
kr_card_payments: true,
|
|
4890
|
+
legacy_payments: true,
|
|
4891
|
+
link_payments: true,
|
|
4892
|
+
mobilepay_payments: true,
|
|
4893
|
+
multibanco_payments: true,
|
|
4894
|
+
mx_bank_transfer_payments: true,
|
|
4895
|
+
naver_pay_payments: true,
|
|
4896
|
+
oxxo_payments: true,
|
|
4897
|
+
p24_payments: true,
|
|
4898
|
+
pay_by_bank_payments: true,
|
|
4899
|
+
payco_payments: true,
|
|
4900
|
+
paynow_payments: true,
|
|
4901
|
+
promptpay_payments: true,
|
|
4902
|
+
revolut_pay_payments: true,
|
|
4903
|
+
samsung_pay_payments: true,
|
|
4904
|
+
sepa_bank_transfer_payments: true,
|
|
4905
|
+
sepa_debit_payments: true,
|
|
4906
|
+
sofort_payments: true,
|
|
4907
|
+
swish_payments: true,
|
|
4908
|
+
tax_reporting_us_1099_k: true,
|
|
4909
|
+
tax_reporting_us_1099_misc: true,
|
|
4910
|
+
transfers: true,
|
|
4911
|
+
treasury: true,
|
|
4912
|
+
twint_payments: true,
|
|
4913
|
+
us_bank_account_ach_payments: true,
|
|
4914
|
+
us_bank_transfer_payments: true,
|
|
4915
|
+
zip_payments: true
|
|
4916
|
+
},
|
|
4917
|
+
requirements: {
|
|
4918
|
+
alternatives: {
|
|
4919
|
+
alternative_fields_due: true,
|
|
4920
|
+
original_fields_due: true
|
|
4921
|
+
},
|
|
4922
|
+
current_deadline: true,
|
|
4923
|
+
currently_due: true,
|
|
4924
|
+
disabled_reason: true,
|
|
4925
|
+
errors: {
|
|
4926
|
+
code: true,
|
|
4927
|
+
reason: true,
|
|
4928
|
+
requirement: true
|
|
4929
|
+
},
|
|
4930
|
+
eventually_due: true,
|
|
4931
|
+
past_due: true,
|
|
4932
|
+
pending_verification: true
|
|
4933
|
+
},
|
|
4934
|
+
future_requirements: {
|
|
4935
|
+
alternatives: {
|
|
4936
|
+
alternative_fields_due: true,
|
|
4937
|
+
original_fields_due: true
|
|
4938
|
+
},
|
|
4939
|
+
current_deadline: true,
|
|
4940
|
+
currently_due: true,
|
|
4941
|
+
disabled_reason: true,
|
|
4942
|
+
errors: {
|
|
4943
|
+
code: true,
|
|
4944
|
+
reason: true,
|
|
4945
|
+
requirement: true
|
|
4946
|
+
},
|
|
4947
|
+
eventually_due: true,
|
|
4948
|
+
past_due: true,
|
|
4949
|
+
pending_verification: true
|
|
4950
|
+
},
|
|
4951
|
+
type: true,
|
|
4952
|
+
charges_enabled: true,
|
|
4953
|
+
payouts_enabled: true,
|
|
4954
|
+
created: true,
|
|
4955
|
+
default_currency: true
|
|
4956
|
+
}
|
|
4957
|
+
};
|
|
4958
|
+
fields._id = true;
|
|
4959
|
+
let retValue = {};
|
|
4960
|
+
try {
|
|
4961
|
+
const response = await client.mutation({
|
|
4962
|
+
createStripeAccount: {
|
|
4963
|
+
__args: {
|
|
4964
|
+
input: dto
|
|
4965
|
+
},
|
|
4966
|
+
...fields
|
|
4967
|
+
}
|
|
4968
|
+
});
|
|
4969
|
+
VTXBaseAPI.Logger.debug('createStripeAccount Response:');
|
|
4970
|
+
VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
|
|
4971
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'createStripeAccount', (r) => {
|
|
4972
|
+
VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
|
|
4973
|
+
const isResponseOk = true && response?.createStripeAccount?._id;
|
|
4974
|
+
return isResponseOk;
|
|
4975
|
+
});
|
|
4976
|
+
}
|
|
4977
|
+
catch (error1) {
|
|
4978
|
+
VTXBaseAPI.Logger.error('createStripeAccount err1:');
|
|
4979
|
+
VTXBaseAPI.Logger.error(error1);
|
|
4980
|
+
retValue = (0, response_builder_1.buildErrorResponse)(error1);
|
|
4981
|
+
}
|
|
4982
|
+
return retValue;
|
|
4983
|
+
}
|
|
4984
|
+
async createAthleteStripeSession(desiredFields) {
|
|
4985
|
+
const client = (0, client_1.createClient)({
|
|
4986
|
+
url: this.backendUrl + "/graphql",
|
|
4987
|
+
headers: this.headers,
|
|
4988
|
+
});
|
|
4989
|
+
const fields = desiredFields ?? {
|
|
4990
|
+
account: true,
|
|
4991
|
+
client_secret: true,
|
|
4992
|
+
expires_at: true,
|
|
4993
|
+
livemode: true
|
|
4994
|
+
};
|
|
4995
|
+
fields.client_secret = true;
|
|
4996
|
+
let retValue = {};
|
|
4997
|
+
try {
|
|
4998
|
+
const response = await client.mutation({
|
|
4999
|
+
createAthleteStripeSession: {
|
|
5000
|
+
__args: {},
|
|
5001
|
+
...fields
|
|
5002
|
+
}
|
|
5003
|
+
});
|
|
5004
|
+
VTXBaseAPI.Logger.debug('createAthleteStripeSession Response:');
|
|
5005
|
+
VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
|
|
5006
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'createAthleteStripeSession', (r) => {
|
|
5007
|
+
VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
|
|
5008
|
+
const isResponseOk = true && response?.createAthleteStripeSession?.client_secret;
|
|
5009
|
+
return isResponseOk;
|
|
5010
|
+
});
|
|
5011
|
+
}
|
|
5012
|
+
catch (error1) {
|
|
5013
|
+
VTXBaseAPI.Logger.error('createAthleteStripeSession err1:');
|
|
5014
|
+
VTXBaseAPI.Logger.error(error1);
|
|
5015
|
+
retValue = (0, response_builder_1.buildErrorResponse)(error1);
|
|
5016
|
+
}
|
|
5017
|
+
return retValue;
|
|
5018
|
+
}
|
|
5019
|
+
async createStripeCheckoutSession(dto, desiredFields) {
|
|
5020
|
+
const client = (0, client_1.createClient)({
|
|
5021
|
+
url: this.backendUrl + "/graphql",
|
|
5022
|
+
headers: this.headers,
|
|
5023
|
+
});
|
|
5024
|
+
const fields = desiredFields ?? {
|
|
5025
|
+
client_secret: true,
|
|
5026
|
+
expires_at: true,
|
|
5027
|
+
livemode: true
|
|
5028
|
+
};
|
|
5029
|
+
fields.client_secret = true;
|
|
5030
|
+
let retValue = {};
|
|
5031
|
+
try {
|
|
5032
|
+
const response = await client.mutation({
|
|
5033
|
+
createStripeCheckoutSession: {
|
|
5034
|
+
__args: {
|
|
5035
|
+
input: dto
|
|
5036
|
+
},
|
|
5037
|
+
...fields
|
|
5038
|
+
}
|
|
5039
|
+
});
|
|
5040
|
+
VTXBaseAPI.Logger.debug('createStripeCheckoutSession Response:');
|
|
5041
|
+
VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
|
|
5042
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'createStripeCheckoutSession', (r) => {
|
|
5043
|
+
VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
|
|
5044
|
+
const isResponseOk = true && response?.createStripeCheckoutSession?.client_secret;
|
|
5045
|
+
return isResponseOk;
|
|
5046
|
+
});
|
|
5047
|
+
}
|
|
5048
|
+
catch (error1) {
|
|
5049
|
+
VTXBaseAPI.Logger.error('createStripeCheckoutSession err1:');
|
|
5050
|
+
VTXBaseAPI.Logger.error(error1);
|
|
5051
|
+
retValue = (0, response_builder_1.buildErrorResponse)(error1);
|
|
5052
|
+
}
|
|
5053
|
+
return retValue;
|
|
5054
|
+
}
|
|
5055
|
+
async getDatabaseTextFile(dto, desiredFields) {
|
|
5056
|
+
const client = (0, client_1.createClient)({
|
|
5057
|
+
url: this.backendUrl + "/graphql",
|
|
5058
|
+
headers: this.headers,
|
|
5059
|
+
});
|
|
5060
|
+
const fields = desiredFields ? { ...desiredFields } : {
|
|
5061
|
+
_id: true,
|
|
5062
|
+
identifier: true,
|
|
5063
|
+
version: true,
|
|
5064
|
+
contentType: true,
|
|
5065
|
+
updated: true,
|
|
5066
|
+
created: true,
|
|
5067
|
+
content: true
|
|
5068
|
+
};
|
|
5069
|
+
fields._id = true;
|
|
5070
|
+
let retValue;
|
|
5071
|
+
try {
|
|
5072
|
+
const response = await client.query({
|
|
5073
|
+
getDatabaseTextFile: {
|
|
5074
|
+
__args: { input: dto },
|
|
5075
|
+
...fields
|
|
5076
|
+
}
|
|
5077
|
+
});
|
|
5078
|
+
VTXBaseAPI.Logger.debug('getDatabaseTextFile Response:');
|
|
5079
|
+
VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
|
|
5080
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'getDatabaseTextFile', (r) => {
|
|
5081
|
+
VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
|
|
5082
|
+
const isResponseOk = true && response?.getDatabaseTextFile._id;
|
|
5083
|
+
return isResponseOk;
|
|
5084
|
+
});
|
|
5085
|
+
}
|
|
5086
|
+
catch (err1) {
|
|
5087
|
+
VTXBaseAPI.Logger.error('getDatabaseTextFile err1:');
|
|
5088
|
+
VTXBaseAPI.Logger.error(err1);
|
|
5089
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
5090
|
+
}
|
|
5091
|
+
return retValue;
|
|
5092
|
+
}
|
|
5093
|
+
async stripeQuery(dto) {
|
|
5094
|
+
const client = (0, client_1.createClient)({
|
|
5095
|
+
url: this.backendUrl + "/graphql",
|
|
5096
|
+
headers: this.headers,
|
|
5097
|
+
});
|
|
5098
|
+
const fields = {
|
|
5099
|
+
type: true,
|
|
5100
|
+
json: true
|
|
5101
|
+
};
|
|
5102
|
+
let retValue;
|
|
5103
|
+
try {
|
|
5104
|
+
const response = await client.query({
|
|
5105
|
+
stripeQuery: {
|
|
5106
|
+
__args: { input: dto },
|
|
5107
|
+
...fields
|
|
5108
|
+
}
|
|
5109
|
+
});
|
|
5110
|
+
VTXBaseAPI.Logger.debug('stripeQuery Response:');
|
|
5111
|
+
VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
|
|
5112
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'stripeQuery', (r) => {
|
|
5113
|
+
VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
|
|
5114
|
+
const isResponseOk = true && response?.stripeQuery.type;
|
|
5115
|
+
return isResponseOk;
|
|
5116
|
+
});
|
|
5117
|
+
}
|
|
5118
|
+
catch (err1) {
|
|
5119
|
+
VTXBaseAPI.Logger.error('stripeQuery err1:');
|
|
5120
|
+
VTXBaseAPI.Logger.error(err1);
|
|
5121
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
5122
|
+
}
|
|
5123
|
+
return retValue;
|
|
5124
|
+
}
|
|
5125
|
+
async setFundingStatus(dto, desiredFields) {
|
|
5126
|
+
const client = (0, client_1.createClient)({
|
|
5127
|
+
url: this.backendUrl + '/graphql',
|
|
5128
|
+
headers: this.headers,
|
|
5129
|
+
});
|
|
5130
|
+
let retValue = {};
|
|
5131
|
+
const fields = desiredFields ?? {
|
|
5132
|
+
_id: true,
|
|
5133
|
+
budgetMode: true,
|
|
5134
|
+
status: true,
|
|
5135
|
+
title: true,
|
|
5136
|
+
motivation: true,
|
|
5137
|
+
website: true,
|
|
5138
|
+
fundsRequired: true,
|
|
5139
|
+
initialFundsObtained: true,
|
|
5140
|
+
fundsObtained: true,
|
|
5141
|
+
vtxComissionPct: true,
|
|
5142
|
+
location: {
|
|
5143
|
+
userProvidedLatitude: true,
|
|
5144
|
+
userProvidedLongitude: true,
|
|
5145
|
+
cityNameGeocode: true,
|
|
5146
|
+
stateNameGeocode: true,
|
|
5147
|
+
countryIso2CodeGeocode: true,
|
|
5148
|
+
timeZoneGeocode: true,
|
|
5149
|
+
latitudeGeocode: true,
|
|
5150
|
+
longitudeGeocode: true,
|
|
5151
|
+
city: {
|
|
5152
|
+
_id: true,
|
|
5153
|
+
name: true,
|
|
5154
|
+
localizedName: true,
|
|
5155
|
+
state: {
|
|
5156
|
+
_id: true,
|
|
5157
|
+
name: true,
|
|
5158
|
+
country: {
|
|
5159
|
+
_id: true,
|
|
5160
|
+
name: true
|
|
5161
|
+
}
|
|
5162
|
+
},
|
|
5163
|
+
latitude: true,
|
|
5164
|
+
longitude: true,
|
|
5165
|
+
timezone: true,
|
|
5166
|
+
}
|
|
5167
|
+
},
|
|
5168
|
+
endingDate: true,
|
|
5169
|
+
budget: {
|
|
5170
|
+
initialFunds: true,
|
|
5171
|
+
totalRequired: true,
|
|
5172
|
+
items: {
|
|
5173
|
+
_id: true,
|
|
5174
|
+
quantity: true,
|
|
5175
|
+
concept: true,
|
|
5176
|
+
itemCost: true
|
|
5177
|
+
}
|
|
5178
|
+
},
|
|
5179
|
+
competitions: {
|
|
5180
|
+
_id: true,
|
|
5181
|
+
event: {
|
|
5182
|
+
_id: true,
|
|
5183
|
+
name: true,
|
|
5184
|
+
mainSport: {
|
|
5185
|
+
_id: true,
|
|
5186
|
+
name: true
|
|
5187
|
+
},
|
|
5188
|
+
eventWebSite: true,
|
|
5189
|
+
startDate: true,
|
|
5190
|
+
endDate: true,
|
|
5191
|
+
verified: true,
|
|
5192
|
+
banner: {
|
|
5193
|
+
_id: true,
|
|
5194
|
+
name: true,
|
|
5195
|
+
contentType: true,
|
|
5196
|
+
size: true,
|
|
5197
|
+
useType: true,
|
|
5198
|
+
url: true,
|
|
5199
|
+
key: true
|
|
5200
|
+
},
|
|
5201
|
+
location: {
|
|
5202
|
+
_id: true,
|
|
5203
|
+
userProvidedLatitude: true,
|
|
5204
|
+
userProvidedLongitude: true,
|
|
5205
|
+
cityNameGeocode: true,
|
|
5206
|
+
stateNameGeocode: true,
|
|
5207
|
+
countryIso2CodeGeocode: true,
|
|
5208
|
+
timeZoneGeocode: true,
|
|
5209
|
+
latitudeGeocode: true,
|
|
5210
|
+
longitudeGeocode: true,
|
|
5211
|
+
city: {
|
|
5212
|
+
_id: true,
|
|
5213
|
+
name: true,
|
|
5214
|
+
localizedName: true,
|
|
5215
|
+
state: {
|
|
5216
|
+
_id: true,
|
|
5217
|
+
name: true,
|
|
5218
|
+
country: {
|
|
5219
|
+
_id: true,
|
|
5220
|
+
name: true
|
|
5221
|
+
}
|
|
5222
|
+
},
|
|
5223
|
+
latitude: true,
|
|
5224
|
+
longitude: true,
|
|
5225
|
+
timezone: true,
|
|
5226
|
+
}
|
|
5227
|
+
},
|
|
5228
|
+
},
|
|
5229
|
+
participationDate: true,
|
|
5230
|
+
competitionNumber: true,
|
|
5231
|
+
result: {
|
|
5232
|
+
resultType: true,
|
|
5233
|
+
position: true,
|
|
5234
|
+
score: true,
|
|
5235
|
+
finishTimeMS: true,
|
|
5236
|
+
resultWebLink: true
|
|
5237
|
+
},
|
|
5238
|
+
fundRaisingCampaignIds: true
|
|
5239
|
+
}
|
|
5240
|
+
};
|
|
5241
|
+
fields._id = true;
|
|
5242
|
+
try {
|
|
5243
|
+
const response = await client.mutation({
|
|
5244
|
+
setFundingStatus: {
|
|
5245
|
+
__args: {
|
|
5246
|
+
input: dto
|
|
5247
|
+
},
|
|
5248
|
+
...fields
|
|
5249
|
+
},
|
|
5250
|
+
});
|
|
5251
|
+
VTXBaseAPI.Logger.log("==================HERE=====================================");
|
|
5252
|
+
VTXBaseAPI.Logger.log('setFundingStatus Response:');
|
|
5253
|
+
VTXBaseAPI.Logger.log(JSON.stringify(response, null, 2));
|
|
5254
|
+
VTXBaseAPI.Logger.log("==================DONE=====================================");
|
|
5255
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'setFundingStatus', (r) => {
|
|
5256
|
+
const isResponseOk = true && response?.setFundingStatus?._id;
|
|
5257
|
+
return isResponseOk;
|
|
5258
|
+
});
|
|
5259
|
+
}
|
|
5260
|
+
catch (err1) {
|
|
5261
|
+
VTXBaseAPI.Logger.log("************** ERROR *******************************");
|
|
5262
|
+
VTXBaseAPI.Logger.log('setFundingStatus err1:');
|
|
5263
|
+
VTXBaseAPI.Logger.log(err1);
|
|
5264
|
+
VTXBaseAPI.Logger.log("************** DONE ERROR **************************");
|
|
5265
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
5266
|
+
}
|
|
5267
|
+
return retValue;
|
|
5268
|
+
}
|
|
5269
|
+
async findAthleteForIdPublic(id) {
|
|
5270
|
+
const client = (0, client_1.createClient)({
|
|
5271
|
+
url: this.backendUrl + "/graphql",
|
|
5272
|
+
headers: this.headers,
|
|
5273
|
+
});
|
|
5274
|
+
let retValue = {};
|
|
5275
|
+
const fields = {
|
|
5276
|
+
_id: true,
|
|
5277
|
+
firstName: true,
|
|
5278
|
+
lastName: true,
|
|
5279
|
+
screenName: true,
|
|
5280
|
+
dob: true,
|
|
5281
|
+
lgbt: true,
|
|
5282
|
+
competitionGender: true,
|
|
5283
|
+
country: {
|
|
5284
|
+
_id: true,
|
|
5285
|
+
name: true
|
|
5286
|
+
},
|
|
5287
|
+
location: {
|
|
5288
|
+
userProvidedLatitude: true,
|
|
5289
|
+
userProvidedLongitude: true,
|
|
5290
|
+
cityNameGeocode: true,
|
|
5291
|
+
stateNameGeocode: true,
|
|
5292
|
+
countryIso2CodeGeocode: true,
|
|
5293
|
+
timeZoneGeocode: true,
|
|
5294
|
+
latitudeGeocode: true,
|
|
5295
|
+
longitudeGeocode: true,
|
|
5296
|
+
city: {
|
|
5297
|
+
_id: true,
|
|
5298
|
+
name: true,
|
|
5299
|
+
localizedName: true,
|
|
5300
|
+
state: {
|
|
5301
|
+
_id: true,
|
|
5302
|
+
name: true,
|
|
5303
|
+
country: {
|
|
5304
|
+
_id: true,
|
|
5305
|
+
name: true
|
|
5306
|
+
}
|
|
5307
|
+
},
|
|
5308
|
+
latitude: true,
|
|
5309
|
+
longitude: true,
|
|
5310
|
+
timezone: true,
|
|
5311
|
+
}
|
|
5312
|
+
},
|
|
5313
|
+
trainer: true,
|
|
5314
|
+
trainerUrl: true,
|
|
5315
|
+
aboutMe: true,
|
|
5316
|
+
followStats: {
|
|
5317
|
+
followers: true,
|
|
5318
|
+
followed: true,
|
|
5319
|
+
raves: true,
|
|
5320
|
+
favorites: true
|
|
5321
|
+
},
|
|
5322
|
+
mainSport: {
|
|
5323
|
+
_id: true,
|
|
5324
|
+
name: true
|
|
5325
|
+
},
|
|
5326
|
+
mainSportLevel: {
|
|
5327
|
+
_id: true,
|
|
5328
|
+
label: true,
|
|
5329
|
+
index: true
|
|
5330
|
+
},
|
|
5331
|
+
scores: {
|
|
5332
|
+
vtxScore: true,
|
|
5333
|
+
socialScore: true,
|
|
5334
|
+
trainingScore: true,
|
|
5335
|
+
competitionScore: true
|
|
5336
|
+
},
|
|
5337
|
+
rankings: {
|
|
5338
|
+
worldRanking: {
|
|
5339
|
+
scope: true,
|
|
5340
|
+
scopeId: true,
|
|
5341
|
+
scopeName: true,
|
|
5342
|
+
position: true,
|
|
5343
|
+
total: true
|
|
5344
|
+
},
|
|
5345
|
+
countryRanking: {
|
|
5346
|
+
scope: true,
|
|
5347
|
+
scopeId: true,
|
|
5348
|
+
scopeName: true,
|
|
5349
|
+
position: true,
|
|
5350
|
+
total: true
|
|
5351
|
+
},
|
|
5352
|
+
stateRanking: {
|
|
5353
|
+
scope: true,
|
|
5354
|
+
scopeId: true,
|
|
5355
|
+
scopeName: true,
|
|
5356
|
+
position: true,
|
|
5357
|
+
total: true
|
|
5358
|
+
},
|
|
5359
|
+
cityRanking: {
|
|
5360
|
+
scope: true,
|
|
5361
|
+
scopeId: true,
|
|
5362
|
+
scopeName: true,
|
|
5363
|
+
position: true,
|
|
5364
|
+
total: true
|
|
5365
|
+
},
|
|
5366
|
+
},
|
|
5367
|
+
allSports: {
|
|
5368
|
+
_id: true,
|
|
5369
|
+
name: true
|
|
5370
|
+
},
|
|
5371
|
+
teams: {
|
|
5372
|
+
_id: true,
|
|
5373
|
+
name: true,
|
|
5374
|
+
description: true,
|
|
5375
|
+
approved: true,
|
|
5376
|
+
logo: {
|
|
5377
|
+
_id: true,
|
|
5378
|
+
name: true,
|
|
5379
|
+
contentType: true,
|
|
5380
|
+
size: true,
|
|
5381
|
+
useType: true,
|
|
5382
|
+
url: true,
|
|
5383
|
+
key: true
|
|
5384
|
+
},
|
|
5385
|
+
banner: {
|
|
5386
|
+
_id: true,
|
|
5387
|
+
name: true,
|
|
5388
|
+
contentType: true,
|
|
5389
|
+
size: true,
|
|
5390
|
+
useType: true,
|
|
5391
|
+
url: true,
|
|
5392
|
+
key: true
|
|
5393
|
+
}
|
|
5394
|
+
},
|
|
5395
|
+
sponsorBrands: {
|
|
5396
|
+
_id: true,
|
|
5397
|
+
name: true,
|
|
5398
|
+
slogan: true,
|
|
5399
|
+
website: true,
|
|
5400
|
+
description: true,
|
|
5401
|
+
approved: true,
|
|
5402
|
+
published: true,
|
|
5403
|
+
logo: {
|
|
5404
|
+
_id: true,
|
|
5405
|
+
name: true,
|
|
5406
|
+
contentType: true,
|
|
5407
|
+
size: true,
|
|
5408
|
+
useType: true,
|
|
5409
|
+
url: true,
|
|
5410
|
+
key: true
|
|
5411
|
+
},
|
|
5412
|
+
stats: {
|
|
5413
|
+
campaigns: true,
|
|
5414
|
+
sponsorships: true,
|
|
5415
|
+
sports: true,
|
|
5416
|
+
athletes: true
|
|
5417
|
+
},
|
|
5418
|
+
operatorIds: true,
|
|
5419
|
+
},
|
|
5420
|
+
competitions: {
|
|
5421
|
+
_id: true,
|
|
5422
|
+
event: {
|
|
5423
|
+
_id: true,
|
|
5424
|
+
name: true,
|
|
5425
|
+
mainSport: {
|
|
5426
|
+
_id: true,
|
|
5427
|
+
name: true
|
|
5428
|
+
},
|
|
5429
|
+
eventWebSite: true,
|
|
5430
|
+
startDate: true,
|
|
5431
|
+
endDate: true,
|
|
5432
|
+
verified: true,
|
|
5433
|
+
location: {
|
|
5434
|
+
_id: true,
|
|
5435
|
+
userProvidedLatitude: true,
|
|
5436
|
+
userProvidedLongitude: true,
|
|
5437
|
+
cityNameGeocode: true,
|
|
5438
|
+
stateNameGeocode: true,
|
|
5439
|
+
countryIso2CodeGeocode: true,
|
|
5440
|
+
timeZoneGeocode: true,
|
|
5441
|
+
latitudeGeocode: true,
|
|
5442
|
+
longitudeGeocode: true,
|
|
5443
|
+
city: {
|
|
5444
|
+
_id: true,
|
|
5445
|
+
name: true,
|
|
5446
|
+
localizedName: true,
|
|
5447
|
+
state: {
|
|
5448
|
+
_id: true,
|
|
5449
|
+
name: true,
|
|
5450
|
+
country: {
|
|
5451
|
+
_id: true,
|
|
5452
|
+
name: true
|
|
5453
|
+
}
|
|
5454
|
+
},
|
|
5455
|
+
latitude: true,
|
|
5456
|
+
longitude: true,
|
|
5457
|
+
timezone: true,
|
|
5458
|
+
}
|
|
5459
|
+
},
|
|
5460
|
+
banner: {
|
|
5461
|
+
_id: true,
|
|
5462
|
+
name: true,
|
|
5463
|
+
contentType: true,
|
|
5464
|
+
size: true,
|
|
5465
|
+
useType: true,
|
|
5466
|
+
url: true,
|
|
5467
|
+
key: true
|
|
5468
|
+
}
|
|
5469
|
+
},
|
|
5470
|
+
participationDate: true,
|
|
5471
|
+
result: {
|
|
5472
|
+
_id: true,
|
|
5473
|
+
resultType: true,
|
|
5474
|
+
position: true,
|
|
5475
|
+
score: true,
|
|
5476
|
+
finishTimeMS: true,
|
|
5477
|
+
resultWebLink: true
|
|
5478
|
+
}
|
|
5479
|
+
},
|
|
5480
|
+
affiliations: {
|
|
5481
|
+
_id: true,
|
|
5482
|
+
organization: {
|
|
5483
|
+
_id: true,
|
|
5484
|
+
shortName: true,
|
|
5485
|
+
acronym: true,
|
|
5486
|
+
fullName: true,
|
|
5487
|
+
website: true,
|
|
5488
|
+
logo: {
|
|
5489
|
+
_id: true,
|
|
5490
|
+
name: true,
|
|
5491
|
+
contentType: true,
|
|
5492
|
+
size: true,
|
|
5493
|
+
useType: true,
|
|
5494
|
+
url: true,
|
|
5495
|
+
key: true
|
|
5496
|
+
}
|
|
5497
|
+
},
|
|
5498
|
+
membershipNumber: true,
|
|
5499
|
+
membershipType: true,
|
|
5500
|
+
issueDate: true,
|
|
5501
|
+
expirationDate: true,
|
|
5502
|
+
},
|
|
5503
|
+
totalUpcomingCompetitions: true,
|
|
5504
|
+
totalPastCompetitions: true,
|
|
5505
|
+
profilePicture: {
|
|
5506
|
+
_id: true,
|
|
5507
|
+
name: true,
|
|
5508
|
+
contentType: true,
|
|
5509
|
+
size: true,
|
|
5510
|
+
useType: true,
|
|
5511
|
+
url: true,
|
|
5512
|
+
key: true
|
|
5513
|
+
},
|
|
5514
|
+
cardPicture: {
|
|
5515
|
+
_id: true,
|
|
5516
|
+
name: true,
|
|
5517
|
+
contentType: true,
|
|
5518
|
+
size: true,
|
|
5519
|
+
useType: true,
|
|
5520
|
+
url: true,
|
|
5521
|
+
key: true
|
|
5522
|
+
},
|
|
5523
|
+
bannerPicture: {
|
|
5524
|
+
_id: true,
|
|
5525
|
+
name: true,
|
|
5526
|
+
contentType: true,
|
|
5527
|
+
size: true,
|
|
5528
|
+
useType: true,
|
|
5529
|
+
url: true,
|
|
5530
|
+
key: true
|
|
5531
|
+
},
|
|
5532
|
+
preferences: {
|
|
5533
|
+
_id: true,
|
|
5534
|
+
showProfileHelper: true,
|
|
5535
|
+
defaultAlbum: {
|
|
5536
|
+
_id: true,
|
|
5537
|
+
label: true,
|
|
5538
|
+
description: true,
|
|
5539
|
+
}
|
|
5540
|
+
},
|
|
5541
|
+
currentCampaign: {
|
|
5542
|
+
_id: true,
|
|
5543
|
+
budgetMode: true,
|
|
5544
|
+
status: true,
|
|
5545
|
+
title: true,
|
|
5546
|
+
motivation: true,
|
|
5547
|
+
website: true,
|
|
5548
|
+
fundsRequired: true,
|
|
5549
|
+
initialFundsObtained: true,
|
|
5550
|
+
fundsObtained: true,
|
|
5551
|
+
location: {
|
|
5552
|
+
_id: true,
|
|
5553
|
+
userProvidedLatitude: true,
|
|
5554
|
+
userProvidedLongitude: true,
|
|
5555
|
+
cityNameGeocode: true,
|
|
5556
|
+
stateNameGeocode: true,
|
|
5557
|
+
countryIso2CodeGeocode: true,
|
|
5558
|
+
timeZoneGeocode: true,
|
|
5559
|
+
latitudeGeocode: true,
|
|
5560
|
+
longitudeGeocode: true,
|
|
5561
|
+
city: {
|
|
5562
|
+
_id: true,
|
|
5563
|
+
name: true,
|
|
5564
|
+
localizedName: true,
|
|
5565
|
+
state: {
|
|
5566
|
+
_id: true,
|
|
5567
|
+
name: true,
|
|
5568
|
+
country: {
|
|
5569
|
+
_id: true,
|
|
5570
|
+
name: true
|
|
5571
|
+
}
|
|
5572
|
+
},
|
|
5573
|
+
latitude: true,
|
|
5574
|
+
longitude: true,
|
|
5575
|
+
timezone: true,
|
|
5576
|
+
}
|
|
5577
|
+
},
|
|
5578
|
+
endingDate: true,
|
|
5579
|
+
budget: {
|
|
5580
|
+
_id: true,
|
|
5581
|
+
initialFunds: true,
|
|
5582
|
+
totalRequired: true,
|
|
5583
|
+
items: {
|
|
5584
|
+
_id: true,
|
|
5585
|
+
quantity: true,
|
|
5586
|
+
concept: true,
|
|
5587
|
+
itemCost: true
|
|
5588
|
+
}
|
|
5589
|
+
},
|
|
5590
|
+
competitions: {
|
|
5591
|
+
_id: true,
|
|
5592
|
+
event: {
|
|
5593
|
+
_id: true,
|
|
5594
|
+
name: true,
|
|
5595
|
+
mainSport: {
|
|
5596
|
+
_id: true,
|
|
5597
|
+
name: true
|
|
5598
|
+
},
|
|
5599
|
+
eventWebSite: true,
|
|
5600
|
+
startDate: true,
|
|
5601
|
+
endDate: true,
|
|
5602
|
+
verified: true,
|
|
5603
|
+
banner: {
|
|
5604
|
+
_id: true,
|
|
5605
|
+
name: true,
|
|
5606
|
+
contentType: true,
|
|
5607
|
+
size: true,
|
|
5608
|
+
useType: true,
|
|
5609
|
+
url: true,
|
|
5610
|
+
key: true
|
|
5611
|
+
},
|
|
5612
|
+
location: {
|
|
5613
|
+
_id: true,
|
|
5614
|
+
userProvidedLatitude: true,
|
|
5615
|
+
userProvidedLongitude: true,
|
|
5616
|
+
cityNameGeocode: true,
|
|
5617
|
+
stateNameGeocode: true,
|
|
5618
|
+
countryIso2CodeGeocode: true,
|
|
5619
|
+
timeZoneGeocode: true,
|
|
5620
|
+
latitudeGeocode: true,
|
|
5621
|
+
longitudeGeocode: true,
|
|
5622
|
+
city: {
|
|
5623
|
+
_id: true,
|
|
5624
|
+
name: true,
|
|
5625
|
+
localizedName: true,
|
|
5626
|
+
state: {
|
|
5627
|
+
_id: true,
|
|
5628
|
+
name: true,
|
|
5629
|
+
country: {
|
|
5630
|
+
_id: true,
|
|
5631
|
+
name: true
|
|
5632
|
+
}
|
|
5633
|
+
},
|
|
5634
|
+
latitude: true,
|
|
5635
|
+
longitude: true,
|
|
5636
|
+
timezone: true,
|
|
5637
|
+
}
|
|
5638
|
+
},
|
|
5639
|
+
},
|
|
5640
|
+
participationDate: true,
|
|
5641
|
+
result: {
|
|
5642
|
+
_id: true,
|
|
5643
|
+
resultType: true,
|
|
5644
|
+
position: true,
|
|
5645
|
+
score: true,
|
|
5646
|
+
finishTimeMS: true,
|
|
5647
|
+
resultWebLink: true
|
|
5648
|
+
}
|
|
5649
|
+
}
|
|
5650
|
+
},
|
|
5651
|
+
};
|
|
5652
|
+
try {
|
|
5653
|
+
let response = null;
|
|
5654
|
+
response = await client.query({
|
|
5655
|
+
findAthletebyIdpublic: {
|
|
5656
|
+
__args: {
|
|
5657
|
+
athleteId: id
|
|
5658
|
+
},
|
|
5659
|
+
...fields
|
|
5660
|
+
}
|
|
5661
|
+
});
|
|
5662
|
+
VTXBaseAPI.Logger.debug('findAthletebyIdpublic Response:');
|
|
5663
|
+
VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
|
|
5664
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'findAthletebyIdpublic', (r) => {
|
|
5665
|
+
const isResponseOk = true && response?.findAthletebyIdpublic?._id;
|
|
5666
|
+
return isResponseOk;
|
|
5667
|
+
});
|
|
5668
|
+
}
|
|
5669
|
+
catch (err1) {
|
|
5670
|
+
VTXBaseAPI.Logger.error('findAthleteForUser err1:');
|
|
5671
|
+
VTXBaseAPI.Logger.error(err1);
|
|
5672
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
5673
|
+
}
|
|
5674
|
+
return retValue;
|
|
5675
|
+
}
|
|
5676
|
+
async editPicture(newPicDto) {
|
|
5677
|
+
console.log('HEADERS:');
|
|
5678
|
+
console.log(JSON.stringify(this.headers, null, 2));
|
|
5679
|
+
const client = (0, client_1.createClient)({
|
|
5680
|
+
url: this.backendUrl + '/graphql',
|
|
5681
|
+
headers: this.headers,
|
|
5682
|
+
});
|
|
5683
|
+
let retValue = {};
|
|
5684
|
+
const fields = {
|
|
5685
|
+
field: true,
|
|
5686
|
+
oldValue: {
|
|
5687
|
+
_id: true,
|
|
5688
|
+
name: true,
|
|
5689
|
+
contentType: true,
|
|
5690
|
+
size: true,
|
|
5691
|
+
useType: true,
|
|
5692
|
+
url: true,
|
|
5693
|
+
key: true
|
|
5694
|
+
},
|
|
5695
|
+
newValue: {
|
|
5696
|
+
_id: true,
|
|
5697
|
+
name: true,
|
|
5698
|
+
contentType: true,
|
|
5699
|
+
size: true,
|
|
5700
|
+
useType: true,
|
|
5701
|
+
url: true,
|
|
5702
|
+
key: true
|
|
5703
|
+
},
|
|
5704
|
+
changed: true
|
|
5705
|
+
};
|
|
5706
|
+
try {
|
|
5707
|
+
const response = await client.mutation({
|
|
5708
|
+
editPicture: {
|
|
5709
|
+
__args: {
|
|
5710
|
+
input: newPicDto
|
|
5711
|
+
},
|
|
5712
|
+
...fields
|
|
5713
|
+
},
|
|
5714
|
+
});
|
|
5715
|
+
VTXBaseAPI.Logger.debug('editPicture Response:');
|
|
5716
|
+
VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
|
|
5717
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'editPicture', (r) => {
|
|
5718
|
+
const isResponseOk = true && response?.editPicture?.field;
|
|
5719
|
+
return isResponseOk;
|
|
5720
|
+
});
|
|
5721
|
+
}
|
|
5722
|
+
catch (err1) {
|
|
5723
|
+
VTXBaseAPI.Logger.error('editProfileValue err1:');
|
|
5724
|
+
VTXBaseAPI.Logger.error(err1);
|
|
5725
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
5726
|
+
}
|
|
5727
|
+
return retValue;
|
|
5728
|
+
}
|
|
5729
|
+
async addAlbumsPictures(dto) {
|
|
5730
|
+
console.log('HEADERS:');
|
|
5731
|
+
console.log(JSON.stringify(this.headers, null, 2));
|
|
5732
|
+
const client = (0, client_1.createClient)({
|
|
5733
|
+
url: this.backendUrl + '/graphql',
|
|
5734
|
+
headers: this.headers,
|
|
5735
|
+
});
|
|
5736
|
+
let retValue = {};
|
|
5737
|
+
const fields = {
|
|
5738
|
+
added: true,
|
|
5739
|
+
failedToAdd: true,
|
|
5740
|
+
failureReason: {
|
|
5741
|
+
code: true,
|
|
5742
|
+
message: true
|
|
5743
|
+
},
|
|
5744
|
+
result: true,
|
|
5745
|
+
};
|
|
5746
|
+
try {
|
|
5747
|
+
const response = await client.mutation({
|
|
5748
|
+
AddAlbumPictures: {
|
|
5749
|
+
__args: {
|
|
5750
|
+
input: dto
|
|
5751
|
+
},
|
|
5752
|
+
...fields
|
|
5753
|
+
},
|
|
5754
|
+
});
|
|
5755
|
+
console.log('AddAlbumsPictures Response:');
|
|
5756
|
+
console.log(JSON.stringify(response, null, 2));
|
|
5757
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'AddAlbumPictures', (r) => {
|
|
5758
|
+
const isResponseOk = response?.AddAlbumPictures?.result === 'success' || response?.AddAlbumPictures?.result === 'partial';
|
|
5759
|
+
return isResponseOk;
|
|
5760
|
+
});
|
|
5761
|
+
}
|
|
5762
|
+
catch (err1) {
|
|
5763
|
+
console.error('addPictures err1:');
|
|
5764
|
+
console.error(err1);
|
|
5765
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
5766
|
+
}
|
|
5767
|
+
console.log('retValue:');
|
|
5768
|
+
console.log(JSON.stringify(retValue, null, 2));
|
|
5769
|
+
return retValue;
|
|
5770
|
+
}
|
|
5771
|
+
async editAlbumsPictures(dto) {
|
|
5772
|
+
console.log('HEADERS:');
|
|
5773
|
+
console.log(JSON.stringify(this.headers, null, 2));
|
|
5774
|
+
const client = (0, client_1.createClient)({
|
|
5775
|
+
url: this.backendUrl + '/graphql',
|
|
5776
|
+
headers: this.headers,
|
|
5777
|
+
});
|
|
5778
|
+
let retValue = {};
|
|
5779
|
+
const fields = {
|
|
5780
|
+
label: true,
|
|
5781
|
+
description: true,
|
|
5782
|
+
photos: {
|
|
5783
|
+
_id: true,
|
|
5784
|
+
photo: {
|
|
5785
|
+
_id: true,
|
|
5786
|
+
name: true,
|
|
5787
|
+
contentType: true,
|
|
5788
|
+
size: true,
|
|
5789
|
+
useType: true,
|
|
5790
|
+
url: true,
|
|
5791
|
+
}
|
|
5792
|
+
}
|
|
5793
|
+
};
|
|
5794
|
+
try {
|
|
5795
|
+
const response = await client.mutation({
|
|
5796
|
+
editAlbum: {
|
|
5797
|
+
__args: {
|
|
5798
|
+
input: dto
|
|
5799
|
+
},
|
|
5800
|
+
...fields
|
|
5801
|
+
},
|
|
5802
|
+
});
|
|
5803
|
+
console.log('editAlbum Response:');
|
|
5804
|
+
console.log(JSON.stringify(response, null, 2));
|
|
5805
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'editAlbum', (r) => {
|
|
5806
|
+
const isResponseOk = response?.editAlbum?.label;
|
|
5807
|
+
return isResponseOk;
|
|
5808
|
+
});
|
|
5809
|
+
}
|
|
5810
|
+
catch (err1) {
|
|
5811
|
+
console.error('editAlbum err1:');
|
|
5812
|
+
console.error(err1);
|
|
5813
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
5814
|
+
}
|
|
5815
|
+
console.log('retValue:');
|
|
5816
|
+
console.log(JSON.stringify(retValue, null, 2));
|
|
5817
|
+
return retValue;
|
|
5818
|
+
}
|
|
5819
|
+
async createAthleteAlbum(dto) {
|
|
5820
|
+
console.log('HEADERS:');
|
|
5821
|
+
console.log(JSON.stringify(this.headers, null, 2));
|
|
5822
|
+
const client = (0, client_1.createClient)({
|
|
5823
|
+
url: this.backendUrl + '/graphql',
|
|
5824
|
+
headers: this.headers,
|
|
5825
|
+
});
|
|
5826
|
+
let retValue = {};
|
|
5827
|
+
const fields = {
|
|
5828
|
+
label: true,
|
|
5829
|
+
description: true,
|
|
5830
|
+
photos: {
|
|
5831
|
+
_id: true,
|
|
5832
|
+
photo: {
|
|
5833
|
+
_id: true,
|
|
5834
|
+
name: true,
|
|
5835
|
+
contentType: true,
|
|
5836
|
+
size: true,
|
|
5837
|
+
useType: true,
|
|
5838
|
+
url: true,
|
|
5839
|
+
}
|
|
5840
|
+
}
|
|
5841
|
+
};
|
|
5842
|
+
try {
|
|
5843
|
+
const response = await client.mutation({
|
|
5844
|
+
createAthleteAlbum: {
|
|
5845
|
+
__args: {
|
|
5846
|
+
input: dto
|
|
5847
|
+
},
|
|
5848
|
+
...fields
|
|
5849
|
+
},
|
|
5850
|
+
});
|
|
5851
|
+
console.log('createAthleteAlbum Response:');
|
|
5852
|
+
console.log(JSON.stringify(response, null, 2));
|
|
5853
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'createAthleteAlbum', (r) => {
|
|
5854
|
+
const isResponseOk = response?.createAthleteAlbum?.label;
|
|
5855
|
+
return isResponseOk;
|
|
5856
|
+
});
|
|
5857
|
+
}
|
|
5858
|
+
catch (err1) {
|
|
5859
|
+
console.error('createAthleteAlbum err1:');
|
|
5860
|
+
console.error(err1);
|
|
5861
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
5862
|
+
}
|
|
5863
|
+
console.log('retValue:');
|
|
5864
|
+
console.log(JSON.stringify(retValue, null, 2));
|
|
5865
|
+
return retValue;
|
|
5866
|
+
}
|
|
5867
|
+
async deleteAthleteAlbum(dto) {
|
|
5868
|
+
console.log('HEADERS:');
|
|
5869
|
+
console.log(JSON.stringify(this.headers, null, 2));
|
|
5870
|
+
const client = (0, client_1.createClient)({
|
|
5871
|
+
url: this.backendUrl + '/graphql',
|
|
5872
|
+
headers: this.headers,
|
|
5873
|
+
});
|
|
5874
|
+
let retValue = {};
|
|
5875
|
+
const fields = {
|
|
5876
|
+
idToDelete: true,
|
|
5877
|
+
deleted: true,
|
|
5878
|
+
failureReason: {
|
|
5879
|
+
code: true,
|
|
5880
|
+
message: true
|
|
5881
|
+
}
|
|
5882
|
+
};
|
|
5883
|
+
try {
|
|
5884
|
+
const response = await client.mutation({
|
|
5885
|
+
deleteAthleteAlbum: {
|
|
5886
|
+
__args: {
|
|
5887
|
+
input: dto
|
|
5888
|
+
},
|
|
5889
|
+
...fields
|
|
5890
|
+
},
|
|
5891
|
+
});
|
|
5892
|
+
console.log('deleteAthleteAlbum Response:');
|
|
5893
|
+
console.log(JSON.stringify(response, null, 2));
|
|
5894
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'deleteAthleteAlbum', (r) => {
|
|
5895
|
+
const isResponseOk = response?.deleteAthleteAlbum?.deleted;
|
|
5896
|
+
return isResponseOk;
|
|
5897
|
+
});
|
|
5898
|
+
}
|
|
5899
|
+
catch (err1) {
|
|
5900
|
+
console.error('createAthleteAlbum err1:');
|
|
5901
|
+
console.error(err1);
|
|
5902
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
5903
|
+
}
|
|
5904
|
+
console.log('retValue:');
|
|
5905
|
+
console.log(JSON.stringify(retValue, null, 2));
|
|
5906
|
+
return retValue;
|
|
5907
|
+
}
|
|
5908
|
+
async getAthleteAlbums() {
|
|
5909
|
+
console.log('HEADERS:');
|
|
5910
|
+
console.log(JSON.stringify(this.headers, null, 2));
|
|
5911
|
+
const client = (0, client_1.createClient)({
|
|
5912
|
+
url: this.backendUrl + '/graphql',
|
|
5913
|
+
headers: this.headers,
|
|
5914
|
+
});
|
|
5915
|
+
let retValue;
|
|
5916
|
+
const fields = {
|
|
5917
|
+
_id: true,
|
|
5918
|
+
label: true,
|
|
5919
|
+
description: true,
|
|
5920
|
+
photos: {
|
|
5921
|
+
_id: true,
|
|
5922
|
+
photo: {
|
|
5923
|
+
_id: true,
|
|
5924
|
+
name: true,
|
|
5925
|
+
contentType: true,
|
|
5926
|
+
size: true,
|
|
5927
|
+
useType: true,
|
|
5928
|
+
url: true,
|
|
5929
|
+
}
|
|
5930
|
+
}
|
|
5931
|
+
};
|
|
5932
|
+
try {
|
|
5933
|
+
const response = await client.query({
|
|
5934
|
+
getAthleteAlbums: {
|
|
5935
|
+
__args: {},
|
|
5936
|
+
...fields
|
|
5937
|
+
},
|
|
5938
|
+
});
|
|
5939
|
+
console.log('getAthleteAlbums Response:');
|
|
5940
|
+
console.log(JSON.stringify(response, null, 2));
|
|
5941
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'getAthleteAlbums', (r) => {
|
|
5942
|
+
const isResponseOk = response?.getAthleteAlbums.length > 0;
|
|
5943
|
+
return isResponseOk;
|
|
5944
|
+
});
|
|
5945
|
+
}
|
|
5946
|
+
catch (err1) {
|
|
5947
|
+
console.error('getAthleteAlbums err1:');
|
|
5948
|
+
console.error(err1);
|
|
5949
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
5950
|
+
}
|
|
5951
|
+
console.log('retValue:');
|
|
5952
|
+
console.log(JSON.stringify(retValue, null, 2));
|
|
5953
|
+
return retValue;
|
|
5954
|
+
}
|
|
5955
|
+
async getPublicAthleteAlbums(athleteId) {
|
|
5956
|
+
console.log('HEADERS:');
|
|
5957
|
+
console.log(JSON.stringify(this.headers, null, 2));
|
|
5958
|
+
const client = (0, client_1.createClient)({
|
|
5959
|
+
url: this.backendUrl + '/graphql',
|
|
5960
|
+
headers: this.headers,
|
|
5961
|
+
});
|
|
5962
|
+
let retValue;
|
|
5963
|
+
const fields = {
|
|
5964
|
+
_id: true,
|
|
5965
|
+
label: true,
|
|
5966
|
+
description: true,
|
|
5967
|
+
photos: {
|
|
5968
|
+
_id: true,
|
|
5969
|
+
photo: {
|
|
5970
|
+
_id: true,
|
|
5971
|
+
name: true,
|
|
5972
|
+
contentType: true,
|
|
5973
|
+
size: true,
|
|
5974
|
+
useType: true,
|
|
5975
|
+
url: true,
|
|
5976
|
+
}
|
|
5977
|
+
}
|
|
5978
|
+
};
|
|
5979
|
+
try {
|
|
5980
|
+
const response = await client.query({
|
|
5981
|
+
getPublicAthleteAlbums: {
|
|
5982
|
+
__args: {
|
|
5983
|
+
athleteId: athleteId
|
|
5984
|
+
},
|
|
5985
|
+
...fields
|
|
5986
|
+
},
|
|
5987
|
+
});
|
|
5988
|
+
console.log('getPublicAthleteAlbums Response:');
|
|
5989
|
+
console.log(JSON.stringify(response, null, 2));
|
|
5990
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'getPublicAthleteAlbums', (r) => {
|
|
5991
|
+
const isResponseOk = response?.getPublicAthleteAlbums.length > 0;
|
|
5992
|
+
return isResponseOk;
|
|
5993
|
+
});
|
|
5994
|
+
}
|
|
5995
|
+
catch (err1) {
|
|
5996
|
+
console.error('getPublicAthleteAlbums err1:');
|
|
5997
|
+
console.error(err1);
|
|
5998
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
5999
|
+
}
|
|
6000
|
+
console.log('retValue:');
|
|
6001
|
+
console.log(JSON.stringify(retValue, null, 2));
|
|
6002
|
+
return retValue;
|
|
6003
|
+
}
|
|
6004
|
+
async getAthleteAlbumsById(albumId) {
|
|
6005
|
+
console.log('HEADERS:');
|
|
6006
|
+
console.log(JSON.stringify(this.headers, null, 2));
|
|
6007
|
+
const client = (0, client_1.createClient)({
|
|
6008
|
+
url: this.backendUrl + '/graphql',
|
|
6009
|
+
headers: this.headers,
|
|
6010
|
+
});
|
|
6011
|
+
let retValue = {};
|
|
6012
|
+
const fields = {
|
|
6013
|
+
label: true,
|
|
6014
|
+
description: true,
|
|
6015
|
+
photos: {
|
|
6016
|
+
_id: true,
|
|
6017
|
+
photo: {
|
|
6018
|
+
_id: true,
|
|
6019
|
+
name: true,
|
|
6020
|
+
contentType: true,
|
|
6021
|
+
size: true,
|
|
6022
|
+
useType: true,
|
|
6023
|
+
url: true,
|
|
6024
|
+
}
|
|
6025
|
+
}
|
|
6026
|
+
};
|
|
6027
|
+
try {
|
|
6028
|
+
const response = await client.query({
|
|
6029
|
+
getAthleteAlbumId: {
|
|
6030
|
+
__args: {
|
|
6031
|
+
input: albumId
|
|
6032
|
+
},
|
|
6033
|
+
...fields
|
|
6034
|
+
},
|
|
6035
|
+
});
|
|
6036
|
+
console.log('getAthleteAlbumId Response:');
|
|
6037
|
+
console.log(JSON.stringify(response, null, 2));
|
|
6038
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'getAthleteAlbumId', (r) => {
|
|
6039
|
+
const isResponseOk = response?.getAthleteAlbumId?._id;
|
|
6040
|
+
return isResponseOk;
|
|
6041
|
+
});
|
|
6042
|
+
}
|
|
6043
|
+
catch (err1) {
|
|
6044
|
+
console.error('getAthleteAlbumId err1:');
|
|
6045
|
+
console.error(err1);
|
|
6046
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
6047
|
+
}
|
|
6048
|
+
console.log('retValue:');
|
|
6049
|
+
console.log(JSON.stringify(retValue, null, 2));
|
|
6050
|
+
return retValue;
|
|
6051
|
+
}
|
|
6052
|
+
async getAndSetAlbumById(albumId) {
|
|
6053
|
+
console.log('HEADERS:');
|
|
6054
|
+
console.log(JSON.stringify(this.headers, null, 2));
|
|
6055
|
+
const client = (0, client_1.createClient)({
|
|
6056
|
+
url: this.backendUrl + '/graphql',
|
|
6057
|
+
headers: this.headers,
|
|
6058
|
+
});
|
|
6059
|
+
let retValue = {};
|
|
6060
|
+
const fields = {
|
|
6061
|
+
_id: true,
|
|
6062
|
+
label: true,
|
|
6063
|
+
description: true,
|
|
6064
|
+
photos: {
|
|
6065
|
+
_id: true,
|
|
6066
|
+
photo: {
|
|
6067
|
+
_id: true,
|
|
6068
|
+
name: true,
|
|
6069
|
+
contentType: true,
|
|
6070
|
+
size: true,
|
|
6071
|
+
useType: true,
|
|
6072
|
+
url: true,
|
|
6073
|
+
}
|
|
6074
|
+
}
|
|
6075
|
+
};
|
|
6076
|
+
try {
|
|
6077
|
+
const response = await client.query({
|
|
6078
|
+
getAndSetAlbumById: {
|
|
6079
|
+
__args: {
|
|
6080
|
+
input: albumId
|
|
6081
|
+
},
|
|
6082
|
+
...fields
|
|
6083
|
+
},
|
|
6084
|
+
});
|
|
6085
|
+
console.log('getAndSetAlbumById Response:');
|
|
6086
|
+
console.log(JSON.stringify(response, null, 2));
|
|
6087
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'getAndSetAlbumById', (r) => {
|
|
6088
|
+
const isResponseOk = response?.getAndSetAlbumById?._id;
|
|
6089
|
+
return isResponseOk;
|
|
6090
|
+
});
|
|
6091
|
+
}
|
|
6092
|
+
catch (err1) {
|
|
6093
|
+
console.error('getAndSetAlbumById err1:');
|
|
6094
|
+
console.error(err1);
|
|
6095
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
6096
|
+
}
|
|
6097
|
+
console.log('retValue:');
|
|
6098
|
+
console.log(JSON.stringify(retValue, null, 2));
|
|
6099
|
+
return retValue;
|
|
6100
|
+
}
|
|
6101
|
+
async queryAthletesWithFilters(dto) {
|
|
6102
|
+
const client = (0, client_1.createClient)({
|
|
6103
|
+
url: this.backendUrl + "/graphql",
|
|
6104
|
+
headers: this.headers,
|
|
6105
|
+
});
|
|
6106
|
+
const fieldsAthlete = {
|
|
6107
|
+
_id: true,
|
|
6108
|
+
firstName: true,
|
|
6109
|
+
lastName: true,
|
|
6110
|
+
screenName: true,
|
|
6111
|
+
dob: true,
|
|
6112
|
+
lgbt: true,
|
|
6113
|
+
competitionGender: true,
|
|
6114
|
+
country: {
|
|
6115
|
+
_id: true,
|
|
6116
|
+
name: true
|
|
6117
|
+
},
|
|
6118
|
+
location: {
|
|
6119
|
+
userProvidedLatitude: true,
|
|
6120
|
+
userProvidedLongitude: true,
|
|
6121
|
+
cityNameGeocode: true,
|
|
6122
|
+
stateNameGeocode: true,
|
|
6123
|
+
countryIso2CodeGeocode: true,
|
|
6124
|
+
timeZoneGeocode: true,
|
|
6125
|
+
latitudeGeocode: true,
|
|
6126
|
+
longitudeGeocode: true,
|
|
6127
|
+
city: {
|
|
6128
|
+
_id: true,
|
|
6129
|
+
name: true,
|
|
6130
|
+
localizedName: true,
|
|
6131
|
+
state: {
|
|
6132
|
+
_id: true,
|
|
6133
|
+
name: true,
|
|
6134
|
+
country: {
|
|
6135
|
+
_id: true,
|
|
6136
|
+
name: true
|
|
6137
|
+
}
|
|
6138
|
+
},
|
|
6139
|
+
latitude: true,
|
|
6140
|
+
longitude: true,
|
|
6141
|
+
timezone: true,
|
|
6142
|
+
}
|
|
6143
|
+
},
|
|
6144
|
+
trainer: true,
|
|
6145
|
+
trainerUrl: true,
|
|
6146
|
+
aboutMe: true,
|
|
6147
|
+
mainSport: {
|
|
6148
|
+
_id: true,
|
|
6149
|
+
name: true
|
|
6150
|
+
},
|
|
6151
|
+
mainSportLevel: {
|
|
6152
|
+
_id: true,
|
|
6153
|
+
label: true,
|
|
6154
|
+
index: true
|
|
6155
|
+
},
|
|
6156
|
+
scores: {
|
|
6157
|
+
vtxScore: true,
|
|
6158
|
+
socialScore: true,
|
|
6159
|
+
trainingScore: true,
|
|
6160
|
+
competitionScore: true
|
|
6161
|
+
},
|
|
6162
|
+
competitions: {
|
|
6163
|
+
_id: true,
|
|
6164
|
+
event: {
|
|
6165
|
+
_id: true,
|
|
6166
|
+
name: true,
|
|
6167
|
+
mainSport: {
|
|
6168
|
+
_id: true,
|
|
6169
|
+
name: true
|
|
6170
|
+
},
|
|
6171
|
+
eventWebSite: true,
|
|
6172
|
+
startDate: true,
|
|
6173
|
+
endDate: true,
|
|
6174
|
+
verified: true,
|
|
6175
|
+
banner: {
|
|
6176
|
+
_id: true,
|
|
6177
|
+
name: true,
|
|
6178
|
+
contentType: true,
|
|
6179
|
+
size: true,
|
|
6180
|
+
useType: true,
|
|
6181
|
+
url: true,
|
|
6182
|
+
key: true
|
|
6183
|
+
},
|
|
6184
|
+
location: {
|
|
6185
|
+
_id: true,
|
|
6186
|
+
userProvidedLatitude: true,
|
|
6187
|
+
userProvidedLongitude: true,
|
|
6188
|
+
cityNameGeocode: true,
|
|
6189
|
+
stateNameGeocode: true,
|
|
6190
|
+
countryIso2CodeGeocode: true,
|
|
6191
|
+
timeZoneGeocode: true,
|
|
6192
|
+
latitudeGeocode: true,
|
|
6193
|
+
longitudeGeocode: true,
|
|
6194
|
+
city: {
|
|
6195
|
+
_id: true,
|
|
6196
|
+
name: true,
|
|
6197
|
+
localizedName: true,
|
|
6198
|
+
state: {
|
|
6199
|
+
_id: true,
|
|
6200
|
+
name: true,
|
|
6201
|
+
country: {
|
|
6202
|
+
_id: true,
|
|
6203
|
+
name: true
|
|
6204
|
+
}
|
|
6205
|
+
},
|
|
6206
|
+
latitude: true,
|
|
6207
|
+
longitude: true,
|
|
6208
|
+
timezone: true,
|
|
6209
|
+
}
|
|
6210
|
+
},
|
|
6211
|
+
},
|
|
6212
|
+
participationDate: true,
|
|
6213
|
+
result: {
|
|
6214
|
+
_id: true,
|
|
6215
|
+
resultType: true,
|
|
6216
|
+
position: true,
|
|
6217
|
+
score: true,
|
|
6218
|
+
finishTimeMS: true,
|
|
6219
|
+
resultWebLink: true
|
|
6220
|
+
}
|
|
6221
|
+
},
|
|
6222
|
+
totalUpcomingCompetitions: true,
|
|
6223
|
+
totalPastCompetitions: true,
|
|
6224
|
+
profilePicture: {
|
|
6225
|
+
_id: true,
|
|
6226
|
+
name: true,
|
|
6227
|
+
contentType: true,
|
|
6228
|
+
size: true,
|
|
6229
|
+
useType: true,
|
|
6230
|
+
url: true,
|
|
6231
|
+
key: true
|
|
6232
|
+
},
|
|
6233
|
+
cardPicture: {
|
|
6234
|
+
_id: true,
|
|
6235
|
+
name: true,
|
|
6236
|
+
contentType: true,
|
|
6237
|
+
size: true,
|
|
6238
|
+
useType: true,
|
|
6239
|
+
url: true,
|
|
6240
|
+
key: true
|
|
6241
|
+
},
|
|
6242
|
+
currentCampaign: {
|
|
6243
|
+
_id: true,
|
|
6244
|
+
budgetMode: true,
|
|
6245
|
+
status: true,
|
|
6246
|
+
title: true,
|
|
6247
|
+
motivation: true,
|
|
6248
|
+
website: true,
|
|
6249
|
+
fundsRequired: true,
|
|
6250
|
+
initialFundsObtained: true,
|
|
6251
|
+
fundsObtained: true,
|
|
6252
|
+
location: {
|
|
6253
|
+
_id: true,
|
|
6254
|
+
userProvidedLatitude: true,
|
|
6255
|
+
userProvidedLongitude: true,
|
|
6256
|
+
cityNameGeocode: true,
|
|
6257
|
+
stateNameGeocode: true,
|
|
6258
|
+
countryIso2CodeGeocode: true,
|
|
6259
|
+
timeZoneGeocode: true,
|
|
6260
|
+
latitudeGeocode: true,
|
|
6261
|
+
longitudeGeocode: true,
|
|
6262
|
+
city: {
|
|
6263
|
+
_id: true,
|
|
6264
|
+
name: true,
|
|
6265
|
+
localizedName: true,
|
|
6266
|
+
state: {
|
|
6267
|
+
_id: true,
|
|
6268
|
+
name: true,
|
|
6269
|
+
country: {
|
|
6270
|
+
_id: true,
|
|
6271
|
+
name: true
|
|
6272
|
+
}
|
|
6273
|
+
},
|
|
6274
|
+
latitude: true,
|
|
6275
|
+
longitude: true,
|
|
6276
|
+
timezone: true,
|
|
6277
|
+
}
|
|
6278
|
+
},
|
|
6279
|
+
endingDate: true,
|
|
6280
|
+
budget: {
|
|
6281
|
+
_id: true,
|
|
6282
|
+
initialFunds: true,
|
|
6283
|
+
totalRequired: true,
|
|
6284
|
+
items: {
|
|
6285
|
+
_id: true,
|
|
6286
|
+
quantity: true,
|
|
6287
|
+
concept: true,
|
|
6288
|
+
itemCost: true
|
|
6289
|
+
}
|
|
6290
|
+
},
|
|
6291
|
+
competitions: {
|
|
6292
|
+
_id: true,
|
|
6293
|
+
event: {
|
|
6294
|
+
_id: true,
|
|
6295
|
+
name: true,
|
|
6296
|
+
mainSport: {
|
|
6297
|
+
_id: true,
|
|
6298
|
+
name: true
|
|
6299
|
+
},
|
|
6300
|
+
eventWebSite: true,
|
|
6301
|
+
startDate: true,
|
|
6302
|
+
endDate: true,
|
|
6303
|
+
verified: true,
|
|
6304
|
+
banner: {
|
|
6305
|
+
_id: true,
|
|
6306
|
+
name: true,
|
|
6307
|
+
contentType: true,
|
|
6308
|
+
size: true,
|
|
6309
|
+
useType: true,
|
|
6310
|
+
url: true,
|
|
6311
|
+
key: true
|
|
6312
|
+
},
|
|
6313
|
+
location: {
|
|
6314
|
+
_id: true,
|
|
6315
|
+
userProvidedLatitude: true,
|
|
6316
|
+
userProvidedLongitude: true,
|
|
6317
|
+
cityNameGeocode: true,
|
|
6318
|
+
stateNameGeocode: true,
|
|
6319
|
+
countryIso2CodeGeocode: true,
|
|
6320
|
+
timeZoneGeocode: true,
|
|
6321
|
+
latitudeGeocode: true,
|
|
6322
|
+
longitudeGeocode: true,
|
|
6323
|
+
city: {
|
|
6324
|
+
_id: true,
|
|
6325
|
+
name: true,
|
|
6326
|
+
localizedName: true,
|
|
6327
|
+
state: {
|
|
6328
|
+
_id: true,
|
|
6329
|
+
name: true,
|
|
6330
|
+
country: {
|
|
6331
|
+
_id: true,
|
|
6332
|
+
name: true
|
|
6333
|
+
}
|
|
6334
|
+
},
|
|
6335
|
+
latitude: true,
|
|
6336
|
+
longitude: true,
|
|
6337
|
+
timezone: true,
|
|
6338
|
+
}
|
|
6339
|
+
},
|
|
6340
|
+
},
|
|
6341
|
+
participationDate: true,
|
|
6342
|
+
result: {
|
|
6343
|
+
_id: true,
|
|
6344
|
+
resultType: true,
|
|
6345
|
+
position: true,
|
|
6346
|
+
score: true,
|
|
6347
|
+
finishTimeMS: true,
|
|
6348
|
+
resultWebLink: true
|
|
6349
|
+
}
|
|
6350
|
+
}
|
|
6351
|
+
}
|
|
6352
|
+
};
|
|
6353
|
+
const fields = {
|
|
6354
|
+
athletes: fieldsAthlete,
|
|
6355
|
+
cursor: {
|
|
6356
|
+
sort: {
|
|
6357
|
+
sortField: true,
|
|
6358
|
+
order: true
|
|
6359
|
+
},
|
|
6360
|
+
initialCursorId: true,
|
|
6361
|
+
nextCursorId: true,
|
|
6362
|
+
initialCursorValue: true,
|
|
6363
|
+
nextCursorValue: true,
|
|
6364
|
+
limit: true,
|
|
6365
|
+
retrieved: true,
|
|
6366
|
+
isLastPage: true
|
|
6367
|
+
}
|
|
6368
|
+
};
|
|
6369
|
+
let retValue;
|
|
6370
|
+
try {
|
|
6371
|
+
const response = await client.query({
|
|
6372
|
+
queryAthleteWithFilter: {
|
|
6373
|
+
__args: { input: dto },
|
|
6374
|
+
...fields
|
|
6375
|
+
}
|
|
6376
|
+
});
|
|
6377
|
+
VTXBaseAPI.Logger.debug('queryAthleteWithFilter Response:');
|
|
6378
|
+
VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
|
|
6379
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'queryAthleteWithFilter', (r) => {
|
|
6380
|
+
VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
|
|
6381
|
+
const isResponseOk = true && Array.isArray(response?.queryAthleteWithFilter?.athletes);
|
|
6382
|
+
return isResponseOk;
|
|
6383
|
+
});
|
|
6384
|
+
}
|
|
6385
|
+
catch (err1) {
|
|
6386
|
+
VTXBaseAPI.Logger.error('queryAthleteFundingCampaigns err1:');
|
|
6387
|
+
VTXBaseAPI.Logger.error(err1);
|
|
6388
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
6389
|
+
}
|
|
6390
|
+
return retValue;
|
|
6391
|
+
}
|
|
6392
|
+
async getAthleteIntegrationsByAthlete() {
|
|
6393
|
+
const client = (0, client_1.createClient)({
|
|
6394
|
+
url: this.backendUrl + '/graphql',
|
|
6395
|
+
headers: this.headers,
|
|
6396
|
+
});
|
|
6397
|
+
let retValue = {};
|
|
6398
|
+
const fields = {
|
|
6399
|
+
_id: true,
|
|
6400
|
+
athlete: {
|
|
6401
|
+
_id: true,
|
|
6402
|
+
},
|
|
6403
|
+
hasInstagramIntegration: true,
|
|
6404
|
+
instagramTokenExpires: true,
|
|
6405
|
+
instagramUserData: {
|
|
6406
|
+
user_id: true,
|
|
6407
|
+
username: true,
|
|
6408
|
+
name: true,
|
|
6409
|
+
account_type: true,
|
|
6410
|
+
followers_count: true,
|
|
6411
|
+
media_count: true
|
|
6412
|
+
},
|
|
6413
|
+
instagramMediaData: {
|
|
6414
|
+
data: {
|
|
6415
|
+
id: true,
|
|
6416
|
+
caption: true,
|
|
6417
|
+
media_type: true,
|
|
6418
|
+
media_url: true,
|
|
6419
|
+
permalink: true,
|
|
6420
|
+
thumbnail_url: true,
|
|
6421
|
+
timestamp: true,
|
|
6422
|
+
username: true,
|
|
6423
|
+
like_count: true,
|
|
6424
|
+
comments_count: true,
|
|
6425
|
+
insights: {
|
|
6426
|
+
data: {
|
|
6427
|
+
name: true,
|
|
6428
|
+
period: true,
|
|
6429
|
+
values: true
|
|
6430
|
+
}
|
|
6431
|
+
}
|
|
6432
|
+
},
|
|
6433
|
+
paging: {
|
|
6434
|
+
cursors: {
|
|
6435
|
+
before: true,
|
|
6436
|
+
after: true
|
|
6437
|
+
},
|
|
6438
|
+
next: true
|
|
6439
|
+
}
|
|
6440
|
+
}
|
|
6441
|
+
};
|
|
6442
|
+
try {
|
|
6443
|
+
const response = await client.query({
|
|
6444
|
+
getAthleteInstagramIntegration: {
|
|
6445
|
+
...fields
|
|
6446
|
+
},
|
|
6447
|
+
});
|
|
6448
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'getAthleteInstagramIntegration', (r) => {
|
|
6449
|
+
const isResponseOk = !!response?.getAthleteInstagramIntegration?._id;
|
|
6450
|
+
return isResponseOk;
|
|
6451
|
+
});
|
|
6452
|
+
}
|
|
6453
|
+
catch (err) {
|
|
6454
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err);
|
|
6455
|
+
}
|
|
6456
|
+
return retValue;
|
|
6457
|
+
}
|
|
6458
|
+
async getAthleteStravaIntegration() {
|
|
6459
|
+
const client = (0, client_1.createClient)({
|
|
6460
|
+
url: this.backendUrl + '/graphql',
|
|
6461
|
+
headers: this.headers,
|
|
6462
|
+
});
|
|
6463
|
+
let retValue = {};
|
|
6464
|
+
const fields = {
|
|
6465
|
+
_id: true,
|
|
6466
|
+
athlete: {
|
|
6467
|
+
_id: true,
|
|
6468
|
+
},
|
|
6469
|
+
hasStravaIntegration: true,
|
|
6470
|
+
stravaTokenExpires: true,
|
|
6471
|
+
stravaAthleteData: {
|
|
6472
|
+
id: true,
|
|
6473
|
+
username: true,
|
|
6474
|
+
firstname: true,
|
|
6475
|
+
lastname: true,
|
|
6476
|
+
bio: true,
|
|
6477
|
+
city: true,
|
|
6478
|
+
state: true,
|
|
6479
|
+
country: true,
|
|
6480
|
+
sex: true,
|
|
6481
|
+
premium: true,
|
|
6482
|
+
profile: true,
|
|
6483
|
+
created_at: true,
|
|
6484
|
+
updated_at: true,
|
|
6485
|
+
weight: true
|
|
6486
|
+
}
|
|
6487
|
+
};
|
|
6488
|
+
try {
|
|
6489
|
+
const response = await client.query({
|
|
6490
|
+
getAthleteStravaIntegration: {
|
|
6491
|
+
...fields
|
|
6492
|
+
},
|
|
6493
|
+
});
|
|
6494
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'getAthleteStravaIntegration', (r) => {
|
|
6495
|
+
const isResponseOk = !!response?.getAthleteStravaIntegration?._id;
|
|
6496
|
+
return isResponseOk;
|
|
6497
|
+
});
|
|
6498
|
+
}
|
|
6499
|
+
catch (err) {
|
|
6500
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err);
|
|
6501
|
+
}
|
|
6502
|
+
return retValue;
|
|
6503
|
+
}
|
|
6504
|
+
async getAthleteInstagramIntegration() {
|
|
6505
|
+
const client = (0, client_1.createClient)({
|
|
6506
|
+
url: this.backendUrl + '/graphql',
|
|
6507
|
+
headers: this.headers,
|
|
6508
|
+
});
|
|
6509
|
+
let retValue = {};
|
|
6510
|
+
const fields = {
|
|
6511
|
+
_id: true,
|
|
6512
|
+
athlete: {
|
|
6513
|
+
_id: true,
|
|
6514
|
+
},
|
|
6515
|
+
hasInstagramIntegration: true,
|
|
6516
|
+
instagramTokenExpires: true,
|
|
6517
|
+
instagramUserData: {
|
|
6518
|
+
user_id: true,
|
|
6519
|
+
username: true,
|
|
6520
|
+
name: true,
|
|
6521
|
+
account_type: true,
|
|
6522
|
+
followers_count: true,
|
|
6523
|
+
media_count: true
|
|
6524
|
+
},
|
|
6525
|
+
instagramMediaData: {
|
|
6526
|
+
data: {
|
|
6527
|
+
id: true,
|
|
6528
|
+
caption: true,
|
|
6529
|
+
media_type: true,
|
|
6530
|
+
media_url: true,
|
|
6531
|
+
permalink: true,
|
|
6532
|
+
thumbnail_url: true,
|
|
6533
|
+
timestamp: true,
|
|
6534
|
+
username: true,
|
|
6535
|
+
like_count: true,
|
|
6536
|
+
comments_count: true,
|
|
6537
|
+
insights: {
|
|
6538
|
+
data: {
|
|
6539
|
+
name: true,
|
|
6540
|
+
period: true,
|
|
6541
|
+
values: true
|
|
6542
|
+
}
|
|
6543
|
+
}
|
|
6544
|
+
},
|
|
6545
|
+
paging: {
|
|
6546
|
+
cursors: {
|
|
6547
|
+
before: true,
|
|
6548
|
+
after: true
|
|
6549
|
+
},
|
|
6550
|
+
next: true
|
|
6551
|
+
}
|
|
6552
|
+
}
|
|
6553
|
+
};
|
|
6554
|
+
try {
|
|
6555
|
+
const response = await client.query({
|
|
6556
|
+
getAthleteInstagramIntegration: {
|
|
6557
|
+
...fields
|
|
6558
|
+
},
|
|
6559
|
+
});
|
|
6560
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'getAthleteInstagramIntegration', (r) => {
|
|
6561
|
+
const isResponseOk = !!response?.getAthleteInstagramIntegration?._id;
|
|
6562
|
+
return isResponseOk;
|
|
6563
|
+
});
|
|
6564
|
+
}
|
|
6565
|
+
catch (err) {
|
|
6566
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err);
|
|
6567
|
+
}
|
|
6568
|
+
return retValue;
|
|
6569
|
+
}
|
|
6570
|
+
async getAthleteIntegrations() {
|
|
6571
|
+
const client = (0, client_1.createClient)({
|
|
6572
|
+
url: this.backendUrl + '/graphql',
|
|
6573
|
+
headers: this.headers,
|
|
6574
|
+
});
|
|
6575
|
+
let retValue = {};
|
|
6576
|
+
const fields = {
|
|
6577
|
+
_id: true,
|
|
6578
|
+
athlete: {
|
|
6579
|
+
_id: true,
|
|
6580
|
+
},
|
|
6581
|
+
hasStravaIntegration: true,
|
|
6582
|
+
stravaTokenExpires: true,
|
|
6583
|
+
stravaAthleteData: {
|
|
6584
|
+
id: true,
|
|
6585
|
+
username: true,
|
|
6586
|
+
firstname: true,
|
|
6587
|
+
lastname: true,
|
|
6588
|
+
bio: true,
|
|
6589
|
+
city: true,
|
|
6590
|
+
state: true,
|
|
6591
|
+
country: true,
|
|
6592
|
+
sex: true,
|
|
6593
|
+
premium: true,
|
|
6594
|
+
profile: true,
|
|
6595
|
+
created_at: true,
|
|
6596
|
+
updated_at: true,
|
|
6597
|
+
weight: true
|
|
6598
|
+
},
|
|
6599
|
+
hasInstagramIntegration: true,
|
|
6600
|
+
instagramTokenExpires: true,
|
|
6601
|
+
instagramUserData: {
|
|
6602
|
+
user_id: true,
|
|
6603
|
+
username: true,
|
|
6604
|
+
name: true,
|
|
6605
|
+
account_type: true,
|
|
6606
|
+
followers_count: true,
|
|
6607
|
+
media_count: true
|
|
6608
|
+
},
|
|
6609
|
+
instagramMediaData: {
|
|
6610
|
+
data: {
|
|
6611
|
+
id: true,
|
|
6612
|
+
caption: true,
|
|
6613
|
+
media_type: true,
|
|
6614
|
+
media_url: true,
|
|
6615
|
+
permalink: true,
|
|
6616
|
+
thumbnail_url: true,
|
|
6617
|
+
timestamp: true,
|
|
6618
|
+
username: true,
|
|
6619
|
+
like_count: true,
|
|
6620
|
+
comments_count: true,
|
|
6621
|
+
insights: {
|
|
6622
|
+
data: {
|
|
6623
|
+
name: true,
|
|
6624
|
+
period: true,
|
|
6625
|
+
values: true
|
|
6626
|
+
}
|
|
6627
|
+
}
|
|
6628
|
+
},
|
|
6629
|
+
paging: {
|
|
6630
|
+
cursors: {
|
|
6631
|
+
before: true,
|
|
6632
|
+
after: true
|
|
6633
|
+
},
|
|
6634
|
+
next: true
|
|
6635
|
+
}
|
|
6636
|
+
}
|
|
6637
|
+
};
|
|
6638
|
+
try {
|
|
6639
|
+
const response = await client.query({
|
|
6640
|
+
getAthleteIntegrations: {
|
|
6641
|
+
...fields
|
|
6642
|
+
},
|
|
6643
|
+
});
|
|
6644
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'getAthleteIntegrations', (r) => {
|
|
6645
|
+
const isResponseOk = !!response?.getAthleteIntegrations?._id;
|
|
6646
|
+
return isResponseOk;
|
|
6647
|
+
});
|
|
6648
|
+
}
|
|
6649
|
+
catch (err) {
|
|
6650
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err);
|
|
6651
|
+
}
|
|
6652
|
+
return retValue;
|
|
6653
|
+
}
|
|
6654
|
+
async updateAthleteIntegration(type) {
|
|
6655
|
+
const client = (0, client_1.createClient)({
|
|
6656
|
+
url: this.backendUrl + '/graphql',
|
|
6657
|
+
headers: this.headers,
|
|
6658
|
+
});
|
|
6659
|
+
let retValue = {};
|
|
6660
|
+
try {
|
|
6661
|
+
const response = await client.mutation({
|
|
6662
|
+
updateAthleteIntegration: {
|
|
6663
|
+
__args: {
|
|
6664
|
+
type: type
|
|
6665
|
+
},
|
|
6666
|
+
}
|
|
6667
|
+
});
|
|
6668
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'updateAthleteIntegration', (r) => {
|
|
6669
|
+
const isResponseOk = response?.updateAthleteIntegration === true;
|
|
6670
|
+
return isResponseOk;
|
|
6671
|
+
});
|
|
6672
|
+
}
|
|
6673
|
+
catch (err) {
|
|
6674
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err);
|
|
6675
|
+
}
|
|
6676
|
+
return retValue;
|
|
6677
|
+
}
|
|
6678
|
+
async deleteUploadedTypeKeyFile(dto) {
|
|
6679
|
+
console.log('HEADERS:');
|
|
6680
|
+
console.log(JSON.stringify(this.headers, null, 2));
|
|
6681
|
+
const client = (0, client_1.createClient)({
|
|
6682
|
+
url: this.backendUrl + '/graphql',
|
|
6683
|
+
headers: this.headers,
|
|
6684
|
+
});
|
|
6685
|
+
let retValue = {};
|
|
6686
|
+
const fields = {
|
|
6687
|
+
httpStatus: true,
|
|
6688
|
+
result: true,
|
|
6689
|
+
message: true,
|
|
6690
|
+
errors: true
|
|
6691
|
+
};
|
|
6692
|
+
try {
|
|
6693
|
+
const response = await client.mutation({
|
|
6694
|
+
deleteUploadedTypeKeyFile: {
|
|
6695
|
+
__args: {
|
|
6696
|
+
input: dto
|
|
6697
|
+
},
|
|
6698
|
+
...fields
|
|
6699
|
+
},
|
|
6700
|
+
});
|
|
6701
|
+
console.log('deleteUploadedTypeKeyFile Response:');
|
|
6702
|
+
console.log(JSON.stringify(response, null, 2));
|
|
6703
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'deleteUploadedTypeKeyFile', (r) => {
|
|
6704
|
+
const isResponseOk = response?.deleteUploadedTypeKeyFile?.httpStatus;
|
|
6705
|
+
return isResponseOk;
|
|
6706
|
+
});
|
|
6707
|
+
}
|
|
6708
|
+
catch (err1) {
|
|
6709
|
+
console.error('deleteUploadedTypeKeyFile err1:');
|
|
6710
|
+
console.error(err1);
|
|
6711
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
6712
|
+
}
|
|
6713
|
+
console.log('retValue:');
|
|
6714
|
+
console.log(JSON.stringify(retValue, null, 2));
|
|
6715
|
+
return retValue;
|
|
6716
|
+
}
|
|
6717
|
+
async saveAthleteCompetitionResult(dto) {
|
|
6718
|
+
const client = (0, client_1.createClient)({
|
|
6719
|
+
url: this.backendUrl + '/graphql',
|
|
6720
|
+
headers: this.headers,
|
|
6721
|
+
});
|
|
6722
|
+
let retValue = {};
|
|
6723
|
+
const fields = {
|
|
6724
|
+
_id: true,
|
|
6725
|
+
resultType: true,
|
|
6726
|
+
position: true,
|
|
6727
|
+
score: true,
|
|
6728
|
+
finishTimeMS: true,
|
|
6729
|
+
resultWebLink: true,
|
|
6730
|
+
};
|
|
6731
|
+
try {
|
|
6732
|
+
const response = await client.mutation({
|
|
6733
|
+
saveAthleteCompetitionResult: {
|
|
6734
|
+
__args: {
|
|
6735
|
+
input: dto
|
|
6736
|
+
},
|
|
6737
|
+
...fields
|
|
6738
|
+
},
|
|
6739
|
+
});
|
|
6740
|
+
VTXBaseAPI.Logger.debug('saveAthleteCompetitionResult Response:');
|
|
6741
|
+
VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
|
|
6742
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'saveAthleteCompetitionResult', (r) => {
|
|
6743
|
+
const isResponseOk = true && response?.saveAthleteCompetitionResult?._id;
|
|
6744
|
+
return isResponseOk;
|
|
6745
|
+
});
|
|
6746
|
+
}
|
|
6747
|
+
catch (err1) {
|
|
6748
|
+
VTXBaseAPI.Logger.error('saveAthleteCompetitionResult err1:');
|
|
6749
|
+
VTXBaseAPI.Logger.error(err1);
|
|
6750
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
6751
|
+
}
|
|
6752
|
+
return retValue;
|
|
6753
|
+
}
|
|
6754
|
+
async updateAthleteTpiScore() {
|
|
6755
|
+
const client = (0, client_1.createClient)({
|
|
6756
|
+
url: this.backendUrl + '/graphql',
|
|
6757
|
+
headers: this.headers,
|
|
6758
|
+
});
|
|
6759
|
+
let retValue = {};
|
|
6760
|
+
try {
|
|
6761
|
+
const response = await client.mutation({
|
|
6762
|
+
updateAthleteTpiScore: {
|
|
6763
|
+
_id: true,
|
|
6764
|
+
firstName: true,
|
|
6765
|
+
lastName: true,
|
|
6766
|
+
scores: {
|
|
6767
|
+
vtxScore: true,
|
|
6768
|
+
socialScore: true,
|
|
6769
|
+
trainingScore: true
|
|
6770
|
+
}
|
|
6771
|
+
},
|
|
6772
|
+
});
|
|
6773
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'updateAthleteTpiScore', (r) => {
|
|
6774
|
+
const isResponseOk = !!response?.updateAthleteTpiScore?._id;
|
|
6775
|
+
return isResponseOk;
|
|
6776
|
+
});
|
|
6777
|
+
}
|
|
6778
|
+
catch (err) {
|
|
6779
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err);
|
|
6780
|
+
}
|
|
6781
|
+
return retValue;
|
|
6782
|
+
}
|
|
6783
|
+
async createResetPasswordCode(email) {
|
|
6784
|
+
console.log('HEADERS:');
|
|
6785
|
+
console.log(JSON.stringify(this.headers, null, 2));
|
|
6786
|
+
const client = (0, client_1.createClient)({
|
|
6787
|
+
url: this.backendUrl + '/graphql',
|
|
6788
|
+
headers: this.headers,
|
|
6789
|
+
});
|
|
6790
|
+
let retValue = {};
|
|
6791
|
+
const fields = {
|
|
6792
|
+
field: true,
|
|
6793
|
+
changed: true,
|
|
6794
|
+
};
|
|
6795
|
+
try {
|
|
6796
|
+
const response = await client.mutation({
|
|
6797
|
+
createResetPasswordCode: {
|
|
6798
|
+
__args: {
|
|
6799
|
+
input: email
|
|
6800
|
+
},
|
|
6801
|
+
...fields
|
|
6802
|
+
},
|
|
6803
|
+
});
|
|
6804
|
+
console.log('createResetPasswordCode Response:');
|
|
6805
|
+
console.log(JSON.stringify(response, null, 2));
|
|
6806
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'createResetPasswordCode', (r) => {
|
|
6807
|
+
const isResponseOk = response?.createResetPasswordCode?.field !== null;
|
|
6808
|
+
return isResponseOk;
|
|
6809
|
+
});
|
|
6810
|
+
}
|
|
6811
|
+
catch (err1) {
|
|
6812
|
+
console.error('createResetPasswordCode err1:');
|
|
6813
|
+
console.error(err1);
|
|
6814
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
6815
|
+
}
|
|
6816
|
+
console.log('retValue:');
|
|
6817
|
+
console.log(JSON.stringify(retValue, null, 2));
|
|
6818
|
+
return retValue;
|
|
6819
|
+
}
|
|
6820
|
+
async getResetVerificationCode(id) {
|
|
6821
|
+
console.log('HEADERS:');
|
|
6822
|
+
console.log(JSON.stringify(this.headers, null, 2));
|
|
6823
|
+
const client = (0, client_1.createClient)({
|
|
6824
|
+
url: this.backendUrl + '/graphql',
|
|
6825
|
+
headers: this.headers,
|
|
6826
|
+
});
|
|
6827
|
+
let retValue = {};
|
|
6828
|
+
const fields = {
|
|
6829
|
+
_id: true,
|
|
6830
|
+
type: true,
|
|
6831
|
+
recipient: true,
|
|
6832
|
+
expires: true,
|
|
6833
|
+
isExpired: true,
|
|
6834
|
+
createdDate: true,
|
|
6835
|
+
};
|
|
6836
|
+
try {
|
|
6837
|
+
const response = await client.query({
|
|
6838
|
+
getResetVerificationCode: {
|
|
6839
|
+
__args: {
|
|
6840
|
+
input: id
|
|
6841
|
+
},
|
|
6842
|
+
...fields
|
|
6843
|
+
},
|
|
6844
|
+
});
|
|
6845
|
+
console.log('getResetVerificationCode Response:');
|
|
6846
|
+
console.log(JSON.stringify(response, null, 2));
|
|
6847
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'getResetVerificationCode', (r) => {
|
|
6848
|
+
const isResponseOk = response?.getResetVerificationCode?.changed;
|
|
6849
|
+
return isResponseOk;
|
|
6850
|
+
});
|
|
6851
|
+
}
|
|
6852
|
+
catch (err1) {
|
|
6853
|
+
console.error('getResetVerificationCode err1:');
|
|
6854
|
+
console.error(err1);
|
|
6855
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
6856
|
+
}
|
|
6857
|
+
console.log('retValue:');
|
|
6858
|
+
console.log(JSON.stringify(retValue, null, 2));
|
|
6859
|
+
return retValue;
|
|
6860
|
+
}
|
|
6861
|
+
async verifyCode(input) {
|
|
6862
|
+
console.log('HEADERS:');
|
|
6863
|
+
console.log(JSON.stringify(this.headers, null, 2));
|
|
6864
|
+
const client = (0, client_1.createClient)({
|
|
6865
|
+
url: this.backendUrl + '/graphql',
|
|
6866
|
+
headers: this.headers,
|
|
6867
|
+
});
|
|
6868
|
+
let retValue = {};
|
|
6869
|
+
const fields = {
|
|
6870
|
+
result: true,
|
|
6871
|
+
code: {
|
|
6872
|
+
_id: true,
|
|
6873
|
+
type: true,
|
|
6874
|
+
recipient: true,
|
|
6875
|
+
expires: true,
|
|
6876
|
+
isExpired: true,
|
|
6877
|
+
createdDate: true,
|
|
6878
|
+
},
|
|
6879
|
+
error: {
|
|
6880
|
+
errorCode: true,
|
|
6881
|
+
errorMessage: true,
|
|
6882
|
+
}
|
|
6883
|
+
};
|
|
6884
|
+
try {
|
|
6885
|
+
const response = await client.query({
|
|
6886
|
+
verifyCode: {
|
|
6887
|
+
__args: {
|
|
6888
|
+
input: input
|
|
6889
|
+
},
|
|
6890
|
+
...fields
|
|
6891
|
+
},
|
|
6892
|
+
});
|
|
6893
|
+
console.log('verifyCode Response:');
|
|
6894
|
+
console.log(JSON.stringify(response, null, 2));
|
|
6895
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'verifyCode', (r) => {
|
|
6896
|
+
const isResponseOk = response?.verifyCode?.result === 'success' || response?.verifyCode?.result === 'error';
|
|
6897
|
+
return isResponseOk;
|
|
6898
|
+
});
|
|
6899
|
+
}
|
|
6900
|
+
catch (err1) {
|
|
6901
|
+
console.error('verifyCode err1:');
|
|
6902
|
+
console.error(err1);
|
|
6903
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
6904
|
+
}
|
|
6905
|
+
console.log('retValue:');
|
|
6906
|
+
console.log(JSON.stringify(retValue, null, 2));
|
|
6907
|
+
return retValue;
|
|
6908
|
+
}
|
|
6909
|
+
async resetUserPassword(input) {
|
|
6910
|
+
console.log('HEADERS:');
|
|
6911
|
+
console.log(JSON.stringify(this.headers, null, 2));
|
|
6912
|
+
const client = (0, client_1.createClient)({
|
|
6913
|
+
url: this.backendUrl + '/graphql',
|
|
6914
|
+
headers: this.headers,
|
|
6915
|
+
});
|
|
6916
|
+
let retValue = {};
|
|
6917
|
+
const fields = {
|
|
6918
|
+
field: true,
|
|
6919
|
+
changed: true,
|
|
6920
|
+
};
|
|
6921
|
+
try {
|
|
6922
|
+
const response = await client.mutation({
|
|
6923
|
+
resetUserPassword: {
|
|
6924
|
+
__args: {
|
|
6925
|
+
input: input
|
|
6926
|
+
},
|
|
6927
|
+
...fields
|
|
6928
|
+
},
|
|
6929
|
+
});
|
|
6930
|
+
console.log('resetUserPassword Response:');
|
|
6931
|
+
console.log(JSON.stringify(response, null, 2));
|
|
6932
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'resetUserPassword', (r) => {
|
|
6933
|
+
const isResponseOk = response?.resetUserPassword?.changed;
|
|
6934
|
+
;
|
|
6935
|
+
return isResponseOk;
|
|
6936
|
+
});
|
|
6937
|
+
}
|
|
6938
|
+
catch (err1) {
|
|
6939
|
+
console.error('resetUserPassword err1:');
|
|
6940
|
+
console.error(err1);
|
|
6941
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
6942
|
+
}
|
|
6943
|
+
console.log('retValue:');
|
|
6944
|
+
console.log(JSON.stringify(retValue, null, 2));
|
|
6945
|
+
return retValue;
|
|
6946
|
+
}
|
|
6947
|
+
async deleteAlbumFotos(dto) {
|
|
6948
|
+
console.log('HEADERS:');
|
|
6949
|
+
console.log(JSON.stringify(this.headers, null, 2));
|
|
6950
|
+
const client = (0, client_1.createClient)({
|
|
6951
|
+
url: this.backendUrl + '/graphql',
|
|
6952
|
+
headers: this.headers,
|
|
6953
|
+
});
|
|
6954
|
+
let retValue = {};
|
|
6955
|
+
const fields = {
|
|
6956
|
+
deleted: true,
|
|
6957
|
+
failedToDelete: true,
|
|
6958
|
+
failureReason: {
|
|
6959
|
+
code: true,
|
|
6960
|
+
message: true
|
|
6961
|
+
},
|
|
6962
|
+
result: true,
|
|
6963
|
+
};
|
|
6964
|
+
try {
|
|
6965
|
+
const response = await client.mutation({
|
|
6966
|
+
deleteAthletePhotos: {
|
|
6967
|
+
__args: {
|
|
6968
|
+
input: dto
|
|
6969
|
+
},
|
|
6970
|
+
...fields
|
|
6971
|
+
},
|
|
6972
|
+
});
|
|
6973
|
+
console.log('deleteAthletePhotos Response:');
|
|
6974
|
+
console.log(JSON.stringify(response, null, 2));
|
|
6975
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'deleteAthletePhotos', (r) => {
|
|
6976
|
+
const isResponseOk = response?.deleteAthletePhotos?.deleted.length > 0;
|
|
6977
|
+
return isResponseOk;
|
|
6978
|
+
});
|
|
6979
|
+
}
|
|
6980
|
+
catch (err1) {
|
|
6981
|
+
console.error('deleteAthletePhotos err1:');
|
|
6982
|
+
console.error(err1);
|
|
6983
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
6984
|
+
}
|
|
6985
|
+
console.log('retValue:');
|
|
6986
|
+
console.log(JSON.stringify(retValue, null, 2));
|
|
6987
|
+
return retValue;
|
|
6988
|
+
}
|
|
4594
6989
|
}
|
|
4595
6990
|
exports.VTXBaseAPI = VTXBaseAPI;
|
|
4596
6991
|
VTXBaseAPI.Logger = {
|