@vertikalx/vtx-backend-client 1.0.0-dev.90 → 1.0.0-dev.91
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 +15 -4
- package/src/api/vtx-base-api.js +584 -58
- package/src/api/vtx-base-api.js.map +1 -1
- package/src/client/schema.d.ts +250 -64
- package/src/client/schema.js +72 -23
- package/src/client/schema.js.map +1 -1
- package/src/client/types.d.ts +110 -27
- package/src/client/types.js +409 -192
- package/src/client/types.js.map +1 -1
- package/tsconfig.lib.tsbuildinfo +1 -1
package/src/api/vtx-base-api.js
CHANGED
|
@@ -1829,11 +1829,11 @@ class VTXBaseAPI {
|
|
|
1829
1829
|
url: this.backendUrl + "/graphql",
|
|
1830
1830
|
headers: this.headers,
|
|
1831
1831
|
});
|
|
1832
|
+
let retValue;
|
|
1832
1833
|
const fields = {
|
|
1833
1834
|
_id: true,
|
|
1834
1835
|
name: true,
|
|
1835
1836
|
};
|
|
1836
|
-
let retValue;
|
|
1837
1837
|
try {
|
|
1838
1838
|
const response = await client.query({
|
|
1839
1839
|
getCountries: {
|
|
@@ -2229,7 +2229,12 @@ class VTXBaseAPI {
|
|
|
2229
2229
|
},
|
|
2230
2230
|
preferences: {
|
|
2231
2231
|
_id: true,
|
|
2232
|
-
showProfileHelper: true
|
|
2232
|
+
showProfileHelper: true,
|
|
2233
|
+
defaultAlbum: {
|
|
2234
|
+
_id: true,
|
|
2235
|
+
label: true,
|
|
2236
|
+
description: true,
|
|
2237
|
+
}
|
|
2233
2238
|
},
|
|
2234
2239
|
currentCampaign: {
|
|
2235
2240
|
_id: true,
|
|
@@ -5305,6 +5310,22 @@ class VTXBaseAPI {
|
|
|
5305
5310
|
timezone: true,
|
|
5306
5311
|
}
|
|
5307
5312
|
},
|
|
5313
|
+
albums: {
|
|
5314
|
+
_id: true,
|
|
5315
|
+
label: true,
|
|
5316
|
+
description: true,
|
|
5317
|
+
photos: {
|
|
5318
|
+
photo: {
|
|
5319
|
+
_id: true,
|
|
5320
|
+
name: true,
|
|
5321
|
+
contentType: true,
|
|
5322
|
+
size: true,
|
|
5323
|
+
useType: true,
|
|
5324
|
+
url: true,
|
|
5325
|
+
key: true,
|
|
5326
|
+
},
|
|
5327
|
+
},
|
|
5328
|
+
},
|
|
5308
5329
|
trainer: true,
|
|
5309
5330
|
trainerUrl: true,
|
|
5310
5331
|
aboutMe: true,
|
|
@@ -5707,45 +5728,6 @@ class VTXBaseAPI {
|
|
|
5707
5728
|
}
|
|
5708
5729
|
return retValue;
|
|
5709
5730
|
}
|
|
5710
|
-
async DeletePictureFromBuket(deleteDto) {
|
|
5711
|
-
console.log('HEADERS:');
|
|
5712
|
-
console.log(JSON.stringify(this.headers, null, 2));
|
|
5713
|
-
const client = (0, client_1.createClient)({
|
|
5714
|
-
url: this.backendUrl + '/graphql',
|
|
5715
|
-
headers: this.headers,
|
|
5716
|
-
});
|
|
5717
|
-
let retValue = {};
|
|
5718
|
-
const fields = {
|
|
5719
|
-
idToDelete: true,
|
|
5720
|
-
deleted: true,
|
|
5721
|
-
failureReason: {
|
|
5722
|
-
code: true,
|
|
5723
|
-
message: true
|
|
5724
|
-
}
|
|
5725
|
-
};
|
|
5726
|
-
try {
|
|
5727
|
-
const response = await client.mutation({
|
|
5728
|
-
DeletePictureBuket: {
|
|
5729
|
-
__args: {
|
|
5730
|
-
input: deleteDto
|
|
5731
|
-
},
|
|
5732
|
-
...fields
|
|
5733
|
-
},
|
|
5734
|
-
});
|
|
5735
|
-
VTXBaseAPI.Logger.debug('deletePicture Response:');
|
|
5736
|
-
VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
|
|
5737
|
-
retValue = (0, response_builder_1.buildResponse)(response, 'DeletePictureBuket', (r) => {
|
|
5738
|
-
const isResponseOk = true && response?.DeletePictureBuket?.idToDelete;
|
|
5739
|
-
return isResponseOk;
|
|
5740
|
-
});
|
|
5741
|
-
}
|
|
5742
|
-
catch (err1) {
|
|
5743
|
-
VTXBaseAPI.Logger.error('editProfileValue err1:');
|
|
5744
|
-
VTXBaseAPI.Logger.error(err1);
|
|
5745
|
-
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
5746
|
-
}
|
|
5747
|
-
return retValue;
|
|
5748
|
-
}
|
|
5749
5731
|
async addAlbumsPictures(dto) {
|
|
5750
5732
|
console.log('HEADERS:');
|
|
5751
5733
|
console.log(JSON.stringify(this.headers, null, 2));
|
|
@@ -5823,7 +5805,7 @@ class VTXBaseAPI {
|
|
|
5823
5805
|
console.log('createAthleteAlbum Response:');
|
|
5824
5806
|
console.log(JSON.stringify(response, null, 2));
|
|
5825
5807
|
retValue = (0, response_builder_1.buildResponse)(response, 'createAthleteAlbum', (r) => {
|
|
5826
|
-
const isResponseOk = response?.createAthleteAlbum?.
|
|
5808
|
+
const isResponseOk = response?.createAthleteAlbum?.label;
|
|
5827
5809
|
return isResponseOk;
|
|
5828
5810
|
});
|
|
5829
5811
|
}
|
|
@@ -5884,8 +5866,9 @@ class VTXBaseAPI {
|
|
|
5884
5866
|
url: this.backendUrl + '/graphql',
|
|
5885
5867
|
headers: this.headers,
|
|
5886
5868
|
});
|
|
5887
|
-
let retValue
|
|
5869
|
+
let retValue;
|
|
5888
5870
|
const fields = {
|
|
5871
|
+
_id: true,
|
|
5889
5872
|
label: true,
|
|
5890
5873
|
description: true,
|
|
5891
5874
|
photos: {
|
|
@@ -5910,7 +5893,7 @@ class VTXBaseAPI {
|
|
|
5910
5893
|
console.log('getAthleteAlbums Response:');
|
|
5911
5894
|
console.log(JSON.stringify(response, null, 2));
|
|
5912
5895
|
retValue = (0, response_builder_1.buildResponse)(response, 'getAthleteAlbums', (r) => {
|
|
5913
|
-
const isResponseOk = response?.getAthleteAlbums
|
|
5896
|
+
const isResponseOk = response?.getAthleteAlbums.length > 0;
|
|
5914
5897
|
return isResponseOk;
|
|
5915
5898
|
});
|
|
5916
5899
|
}
|
|
@@ -5923,7 +5906,7 @@ class VTXBaseAPI {
|
|
|
5923
5906
|
console.log(JSON.stringify(retValue, null, 2));
|
|
5924
5907
|
return retValue;
|
|
5925
5908
|
}
|
|
5926
|
-
async getAthleteAlbumsById() {
|
|
5909
|
+
async getAthleteAlbumsById(albumId) {
|
|
5927
5910
|
console.log('HEADERS:');
|
|
5928
5911
|
console.log(JSON.stringify(this.headers, null, 2));
|
|
5929
5912
|
const client = (0, client_1.createClient)({
|
|
@@ -5948,20 +5931,71 @@ class VTXBaseAPI {
|
|
|
5948
5931
|
};
|
|
5949
5932
|
try {
|
|
5950
5933
|
const response = await client.query({
|
|
5951
|
-
|
|
5952
|
-
__args: {
|
|
5934
|
+
getAthleteAlbumId: {
|
|
5935
|
+
__args: {
|
|
5936
|
+
input: albumId
|
|
5937
|
+
},
|
|
5953
5938
|
...fields
|
|
5954
5939
|
},
|
|
5955
5940
|
});
|
|
5956
|
-
console.log('
|
|
5941
|
+
console.log('getAthleteAlbumId Response:');
|
|
5957
5942
|
console.log(JSON.stringify(response, null, 2));
|
|
5958
|
-
retValue = (0, response_builder_1.buildResponse)(response, '
|
|
5959
|
-
const isResponseOk = response?.
|
|
5943
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'getAthleteAlbumId', (r) => {
|
|
5944
|
+
const isResponseOk = response?.getAthleteAlbumId?._id;
|
|
5960
5945
|
return isResponseOk;
|
|
5961
5946
|
});
|
|
5962
5947
|
}
|
|
5963
5948
|
catch (err1) {
|
|
5964
|
-
console.error('
|
|
5949
|
+
console.error('getAthleteAlbumId err1:');
|
|
5950
|
+
console.error(err1);
|
|
5951
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
5952
|
+
}
|
|
5953
|
+
console.log('retValue:');
|
|
5954
|
+
console.log(JSON.stringify(retValue, null, 2));
|
|
5955
|
+
return retValue;
|
|
5956
|
+
}
|
|
5957
|
+
async getAndSetAlbumById(albumId) {
|
|
5958
|
+
console.log('HEADERS:');
|
|
5959
|
+
console.log(JSON.stringify(this.headers, null, 2));
|
|
5960
|
+
const client = (0, client_1.createClient)({
|
|
5961
|
+
url: this.backendUrl + '/graphql',
|
|
5962
|
+
headers: this.headers,
|
|
5963
|
+
});
|
|
5964
|
+
let retValue = {};
|
|
5965
|
+
const fields = {
|
|
5966
|
+
_id: true,
|
|
5967
|
+
label: true,
|
|
5968
|
+
description: true,
|
|
5969
|
+
photos: {
|
|
5970
|
+
_id: true,
|
|
5971
|
+
photo: {
|
|
5972
|
+
_id: true,
|
|
5973
|
+
name: true,
|
|
5974
|
+
contentType: true,
|
|
5975
|
+
size: true,
|
|
5976
|
+
useType: true,
|
|
5977
|
+
url: true,
|
|
5978
|
+
}
|
|
5979
|
+
}
|
|
5980
|
+
};
|
|
5981
|
+
try {
|
|
5982
|
+
const response = await client.query({
|
|
5983
|
+
getAndSetAlbumById: {
|
|
5984
|
+
__args: {
|
|
5985
|
+
input: albumId
|
|
5986
|
+
},
|
|
5987
|
+
...fields
|
|
5988
|
+
},
|
|
5989
|
+
});
|
|
5990
|
+
console.log('getAndSetAlbumById Response:');
|
|
5991
|
+
console.log(JSON.stringify(response, null, 2));
|
|
5992
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'getAndSetAlbumById', (r) => {
|
|
5993
|
+
const isResponseOk = response?.getAndSetAlbumById?._id;
|
|
5994
|
+
return isResponseOk;
|
|
5995
|
+
});
|
|
5996
|
+
}
|
|
5997
|
+
catch (err1) {
|
|
5998
|
+
console.error('getAndSetAlbumById err1:');
|
|
5965
5999
|
console.error(err1);
|
|
5966
6000
|
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
5967
6001
|
}
|
|
@@ -6261,6 +6295,72 @@ class VTXBaseAPI {
|
|
|
6261
6295
|
return retValue;
|
|
6262
6296
|
}
|
|
6263
6297
|
async getAthleteIntegrationsByAthlete() {
|
|
6298
|
+
const client = (0, client_1.createClient)({
|
|
6299
|
+
url: this.backendUrl + '/graphql',
|
|
6300
|
+
headers: this.headers,
|
|
6301
|
+
});
|
|
6302
|
+
let retValue = {};
|
|
6303
|
+
const fields = {
|
|
6304
|
+
_id: true,
|
|
6305
|
+
athlete: {
|
|
6306
|
+
_id: true,
|
|
6307
|
+
},
|
|
6308
|
+
hasInstagramIntegration: true,
|
|
6309
|
+
instagramTokenExpires: true,
|
|
6310
|
+
instagramUserData: {
|
|
6311
|
+
user_id: true,
|
|
6312
|
+
username: true,
|
|
6313
|
+
name: true,
|
|
6314
|
+
account_type: true,
|
|
6315
|
+
followers_count: true,
|
|
6316
|
+
media_count: true
|
|
6317
|
+
},
|
|
6318
|
+
instagramMediaData: {
|
|
6319
|
+
data: {
|
|
6320
|
+
id: true,
|
|
6321
|
+
caption: true,
|
|
6322
|
+
media_type: true,
|
|
6323
|
+
media_url: true,
|
|
6324
|
+
permalink: true,
|
|
6325
|
+
thumbnail_url: true,
|
|
6326
|
+
timestamp: true,
|
|
6327
|
+
username: true,
|
|
6328
|
+
like_count: true,
|
|
6329
|
+
comments_count: true,
|
|
6330
|
+
insights: {
|
|
6331
|
+
data: {
|
|
6332
|
+
name: true,
|
|
6333
|
+
period: true,
|
|
6334
|
+
values: true
|
|
6335
|
+
}
|
|
6336
|
+
}
|
|
6337
|
+
},
|
|
6338
|
+
paging: {
|
|
6339
|
+
cursors: {
|
|
6340
|
+
before: true,
|
|
6341
|
+
after: true
|
|
6342
|
+
},
|
|
6343
|
+
next: true
|
|
6344
|
+
}
|
|
6345
|
+
}
|
|
6346
|
+
};
|
|
6347
|
+
try {
|
|
6348
|
+
const response = await client.query({
|
|
6349
|
+
getAthleteInstagramIntegration: {
|
|
6350
|
+
...fields
|
|
6351
|
+
},
|
|
6352
|
+
});
|
|
6353
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'getAthleteInstagramIntegration', (r) => {
|
|
6354
|
+
const isResponseOk = !!response?.getAthleteInstagramIntegration?._id;
|
|
6355
|
+
return isResponseOk;
|
|
6356
|
+
});
|
|
6357
|
+
}
|
|
6358
|
+
catch (err) {
|
|
6359
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err);
|
|
6360
|
+
}
|
|
6361
|
+
return retValue;
|
|
6362
|
+
}
|
|
6363
|
+
async getAthleteStravaIntegration() {
|
|
6264
6364
|
const client = (0, client_1.createClient)({
|
|
6265
6365
|
url: this.backendUrl + '/graphql',
|
|
6266
6366
|
headers: this.headers,
|
|
@@ -6292,12 +6392,162 @@ class VTXBaseAPI {
|
|
|
6292
6392
|
};
|
|
6293
6393
|
try {
|
|
6294
6394
|
const response = await client.query({
|
|
6295
|
-
|
|
6395
|
+
getAthleteStravaIntegration: {
|
|
6396
|
+
...fields
|
|
6397
|
+
},
|
|
6398
|
+
});
|
|
6399
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'getAthleteStravaIntegration', (r) => {
|
|
6400
|
+
const isResponseOk = !!response?.getAthleteStravaIntegration?._id;
|
|
6401
|
+
return isResponseOk;
|
|
6402
|
+
});
|
|
6403
|
+
}
|
|
6404
|
+
catch (err) {
|
|
6405
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err);
|
|
6406
|
+
}
|
|
6407
|
+
return retValue;
|
|
6408
|
+
}
|
|
6409
|
+
async getAthleteInstagramIntegration() {
|
|
6410
|
+
const client = (0, client_1.createClient)({
|
|
6411
|
+
url: this.backendUrl + '/graphql',
|
|
6412
|
+
headers: this.headers,
|
|
6413
|
+
});
|
|
6414
|
+
let retValue = {};
|
|
6415
|
+
const fields = {
|
|
6416
|
+
_id: true,
|
|
6417
|
+
athlete: {
|
|
6418
|
+
_id: true,
|
|
6419
|
+
},
|
|
6420
|
+
hasInstagramIntegration: true,
|
|
6421
|
+
instagramTokenExpires: true,
|
|
6422
|
+
instagramUserData: {
|
|
6423
|
+
user_id: true,
|
|
6424
|
+
username: true,
|
|
6425
|
+
name: true,
|
|
6426
|
+
account_type: true,
|
|
6427
|
+
followers_count: true,
|
|
6428
|
+
media_count: true
|
|
6429
|
+
},
|
|
6430
|
+
instagramMediaData: {
|
|
6431
|
+
data: {
|
|
6432
|
+
id: true,
|
|
6433
|
+
caption: true,
|
|
6434
|
+
media_type: true,
|
|
6435
|
+
media_url: true,
|
|
6436
|
+
permalink: true,
|
|
6437
|
+
thumbnail_url: true,
|
|
6438
|
+
timestamp: true,
|
|
6439
|
+
username: true,
|
|
6440
|
+
like_count: true,
|
|
6441
|
+
comments_count: true,
|
|
6442
|
+
insights: {
|
|
6443
|
+
data: {
|
|
6444
|
+
name: true,
|
|
6445
|
+
period: true,
|
|
6446
|
+
values: true
|
|
6447
|
+
}
|
|
6448
|
+
}
|
|
6449
|
+
},
|
|
6450
|
+
paging: {
|
|
6451
|
+
cursors: {
|
|
6452
|
+
before: true,
|
|
6453
|
+
after: true
|
|
6454
|
+
},
|
|
6455
|
+
next: true
|
|
6456
|
+
}
|
|
6457
|
+
}
|
|
6458
|
+
};
|
|
6459
|
+
try {
|
|
6460
|
+
const response = await client.query({
|
|
6461
|
+
getAthleteInstagramIntegration: {
|
|
6462
|
+
...fields
|
|
6463
|
+
},
|
|
6464
|
+
});
|
|
6465
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'getAthleteInstagramIntegration', (r) => {
|
|
6466
|
+
const isResponseOk = !!response?.getAthleteInstagramIntegration?._id;
|
|
6467
|
+
return isResponseOk;
|
|
6468
|
+
});
|
|
6469
|
+
}
|
|
6470
|
+
catch (err) {
|
|
6471
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err);
|
|
6472
|
+
}
|
|
6473
|
+
return retValue;
|
|
6474
|
+
}
|
|
6475
|
+
async getAthleteIntegrations() {
|
|
6476
|
+
const client = (0, client_1.createClient)({
|
|
6477
|
+
url: this.backendUrl + '/graphql',
|
|
6478
|
+
headers: this.headers,
|
|
6479
|
+
});
|
|
6480
|
+
let retValue = {};
|
|
6481
|
+
const fields = {
|
|
6482
|
+
_id: true,
|
|
6483
|
+
athlete: {
|
|
6484
|
+
_id: true,
|
|
6485
|
+
},
|
|
6486
|
+
hasStravaIntegration: true,
|
|
6487
|
+
stravaTokenExpires: true,
|
|
6488
|
+
stravaAthleteData: {
|
|
6489
|
+
id: true,
|
|
6490
|
+
username: true,
|
|
6491
|
+
firstname: true,
|
|
6492
|
+
lastname: true,
|
|
6493
|
+
bio: true,
|
|
6494
|
+
city: true,
|
|
6495
|
+
state: true,
|
|
6496
|
+
country: true,
|
|
6497
|
+
sex: true,
|
|
6498
|
+
premium: true,
|
|
6499
|
+
profile: true,
|
|
6500
|
+
created_at: true,
|
|
6501
|
+
updated_at: true,
|
|
6502
|
+
weight: true
|
|
6503
|
+
},
|
|
6504
|
+
hasInstagramIntegration: true,
|
|
6505
|
+
instagramTokenExpires: true,
|
|
6506
|
+
instagramUserData: {
|
|
6507
|
+
user_id: true,
|
|
6508
|
+
username: true,
|
|
6509
|
+
name: true,
|
|
6510
|
+
account_type: true,
|
|
6511
|
+
followers_count: true,
|
|
6512
|
+
media_count: true
|
|
6513
|
+
},
|
|
6514
|
+
instagramMediaData: {
|
|
6515
|
+
data: {
|
|
6516
|
+
id: true,
|
|
6517
|
+
caption: true,
|
|
6518
|
+
media_type: true,
|
|
6519
|
+
media_url: true,
|
|
6520
|
+
permalink: true,
|
|
6521
|
+
thumbnail_url: true,
|
|
6522
|
+
timestamp: true,
|
|
6523
|
+
username: true,
|
|
6524
|
+
like_count: true,
|
|
6525
|
+
comments_count: true,
|
|
6526
|
+
insights: {
|
|
6527
|
+
data: {
|
|
6528
|
+
name: true,
|
|
6529
|
+
period: true,
|
|
6530
|
+
values: true
|
|
6531
|
+
}
|
|
6532
|
+
}
|
|
6533
|
+
},
|
|
6534
|
+
paging: {
|
|
6535
|
+
cursors: {
|
|
6536
|
+
before: true,
|
|
6537
|
+
after: true
|
|
6538
|
+
},
|
|
6539
|
+
next: true
|
|
6540
|
+
}
|
|
6541
|
+
}
|
|
6542
|
+
};
|
|
6543
|
+
try {
|
|
6544
|
+
const response = await client.query({
|
|
6545
|
+
getAthleteIntegrations: {
|
|
6296
6546
|
...fields
|
|
6297
6547
|
},
|
|
6298
6548
|
});
|
|
6299
|
-
retValue = (0, response_builder_1.buildResponse)(response, '
|
|
6300
|
-
const isResponseOk = !!response?.
|
|
6549
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'getAthleteIntegrations', (r) => {
|
|
6550
|
+
const isResponseOk = !!response?.getAthleteIntegrations?._id;
|
|
6301
6551
|
return isResponseOk;
|
|
6302
6552
|
});
|
|
6303
6553
|
}
|
|
@@ -6306,7 +6556,7 @@ class VTXBaseAPI {
|
|
|
6306
6556
|
}
|
|
6307
6557
|
return retValue;
|
|
6308
6558
|
}
|
|
6309
|
-
async
|
|
6559
|
+
async updateAthleteIntegration(type) {
|
|
6310
6560
|
const client = (0, client_1.createClient)({
|
|
6311
6561
|
url: this.backendUrl + '/graphql',
|
|
6312
6562
|
headers: this.headers,
|
|
@@ -6314,10 +6564,14 @@ class VTXBaseAPI {
|
|
|
6314
6564
|
let retValue = {};
|
|
6315
6565
|
try {
|
|
6316
6566
|
const response = await client.mutation({
|
|
6317
|
-
|
|
6567
|
+
updateAthleteIntegration: {
|
|
6568
|
+
__args: {
|
|
6569
|
+
type: type
|
|
6570
|
+
},
|
|
6571
|
+
}
|
|
6318
6572
|
});
|
|
6319
|
-
retValue = (0, response_builder_1.buildResponse)(response, '
|
|
6320
|
-
const isResponseOk = response?.
|
|
6573
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'updateAthleteIntegration', (r) => {
|
|
6574
|
+
const isResponseOk = response?.updateAthleteIntegration === true;
|
|
6321
6575
|
return isResponseOk;
|
|
6322
6576
|
});
|
|
6323
6577
|
}
|
|
@@ -6365,6 +6619,278 @@ class VTXBaseAPI {
|
|
|
6365
6619
|
console.log(JSON.stringify(retValue, null, 2));
|
|
6366
6620
|
return retValue;
|
|
6367
6621
|
}
|
|
6622
|
+
async saveAthleteCompetitionResult(dto) {
|
|
6623
|
+
const client = (0, client_1.createClient)({
|
|
6624
|
+
url: this.backendUrl + '/graphql',
|
|
6625
|
+
headers: this.headers,
|
|
6626
|
+
});
|
|
6627
|
+
let retValue = {};
|
|
6628
|
+
const fields = {
|
|
6629
|
+
_id: true,
|
|
6630
|
+
resultType: true,
|
|
6631
|
+
position: true,
|
|
6632
|
+
score: true,
|
|
6633
|
+
finishTimeMS: true,
|
|
6634
|
+
resultWebLink: true,
|
|
6635
|
+
};
|
|
6636
|
+
try {
|
|
6637
|
+
const response = await client.mutation({
|
|
6638
|
+
saveAthleteCompetitionResult: {
|
|
6639
|
+
__args: {
|
|
6640
|
+
input: dto
|
|
6641
|
+
},
|
|
6642
|
+
...fields
|
|
6643
|
+
},
|
|
6644
|
+
});
|
|
6645
|
+
VTXBaseAPI.Logger.debug('saveAthleteCompetitionResult Response:');
|
|
6646
|
+
VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
|
|
6647
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'saveAthleteCompetitionResult', (r) => {
|
|
6648
|
+
const isResponseOk = true && response?.saveAthleteCompetitionResult?._id;
|
|
6649
|
+
return isResponseOk;
|
|
6650
|
+
});
|
|
6651
|
+
}
|
|
6652
|
+
catch (err1) {
|
|
6653
|
+
VTXBaseAPI.Logger.error('saveAthleteCompetitionResult err1:');
|
|
6654
|
+
VTXBaseAPI.Logger.error(err1);
|
|
6655
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
6656
|
+
}
|
|
6657
|
+
return retValue;
|
|
6658
|
+
}
|
|
6659
|
+
async updateAthleteTpiScore() {
|
|
6660
|
+
const client = (0, client_1.createClient)({
|
|
6661
|
+
url: this.backendUrl + '/graphql',
|
|
6662
|
+
headers: this.headers,
|
|
6663
|
+
});
|
|
6664
|
+
let retValue = {};
|
|
6665
|
+
try {
|
|
6666
|
+
const response = await client.mutation({
|
|
6667
|
+
updateAthleteTpiScore: {
|
|
6668
|
+
_id: true,
|
|
6669
|
+
firstName: true,
|
|
6670
|
+
lastName: true,
|
|
6671
|
+
scores: {
|
|
6672
|
+
vtxScore: true,
|
|
6673
|
+
socialScore: true,
|
|
6674
|
+
trainingScore: true
|
|
6675
|
+
}
|
|
6676
|
+
},
|
|
6677
|
+
});
|
|
6678
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'updateAthleteTpiScore', (r) => {
|
|
6679
|
+
const isResponseOk = !!response?.updateAthleteTpiScore?._id;
|
|
6680
|
+
return isResponseOk;
|
|
6681
|
+
});
|
|
6682
|
+
}
|
|
6683
|
+
catch (err) {
|
|
6684
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err);
|
|
6685
|
+
}
|
|
6686
|
+
return retValue;
|
|
6687
|
+
}
|
|
6688
|
+
async createResetPasswordCode(email) {
|
|
6689
|
+
console.log('HEADERS:');
|
|
6690
|
+
console.log(JSON.stringify(this.headers, null, 2));
|
|
6691
|
+
const client = (0, client_1.createClient)({
|
|
6692
|
+
url: this.backendUrl + '/graphql',
|
|
6693
|
+
headers: this.headers,
|
|
6694
|
+
});
|
|
6695
|
+
let retValue = {};
|
|
6696
|
+
const fields = {
|
|
6697
|
+
field: true,
|
|
6698
|
+
changed: true,
|
|
6699
|
+
};
|
|
6700
|
+
try {
|
|
6701
|
+
const response = await client.mutation({
|
|
6702
|
+
createResetPasswordCode: {
|
|
6703
|
+
__args: {
|
|
6704
|
+
input: email
|
|
6705
|
+
},
|
|
6706
|
+
...fields
|
|
6707
|
+
},
|
|
6708
|
+
});
|
|
6709
|
+
console.log('createResetPasswordCode Response:');
|
|
6710
|
+
console.log(JSON.stringify(response, null, 2));
|
|
6711
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'createResetPasswordCode', (r) => {
|
|
6712
|
+
const isResponseOk = response?.createResetPasswordCode?.field !== null;
|
|
6713
|
+
return isResponseOk;
|
|
6714
|
+
});
|
|
6715
|
+
}
|
|
6716
|
+
catch (err1) {
|
|
6717
|
+
console.error('createResetPasswordCode err1:');
|
|
6718
|
+
console.error(err1);
|
|
6719
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
6720
|
+
}
|
|
6721
|
+
console.log('retValue:');
|
|
6722
|
+
console.log(JSON.stringify(retValue, null, 2));
|
|
6723
|
+
return retValue;
|
|
6724
|
+
}
|
|
6725
|
+
async getResetVerificationCode(id) {
|
|
6726
|
+
console.log('HEADERS:');
|
|
6727
|
+
console.log(JSON.stringify(this.headers, null, 2));
|
|
6728
|
+
const client = (0, client_1.createClient)({
|
|
6729
|
+
url: this.backendUrl + '/graphql',
|
|
6730
|
+
headers: this.headers,
|
|
6731
|
+
});
|
|
6732
|
+
let retValue = {};
|
|
6733
|
+
const fields = {
|
|
6734
|
+
_id: true,
|
|
6735
|
+
type: true,
|
|
6736
|
+
recipient: true,
|
|
6737
|
+
expires: true,
|
|
6738
|
+
isExpired: true,
|
|
6739
|
+
createdDate: true,
|
|
6740
|
+
};
|
|
6741
|
+
try {
|
|
6742
|
+
const response = await client.query({
|
|
6743
|
+
getResetVerificationCode: {
|
|
6744
|
+
__args: {
|
|
6745
|
+
input: id
|
|
6746
|
+
},
|
|
6747
|
+
...fields
|
|
6748
|
+
},
|
|
6749
|
+
});
|
|
6750
|
+
console.log('getResetVerificationCode Response:');
|
|
6751
|
+
console.log(JSON.stringify(response, null, 2));
|
|
6752
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'getResetVerificationCode', (r) => {
|
|
6753
|
+
const isResponseOk = response?.getResetVerificationCode?.changed;
|
|
6754
|
+
return isResponseOk;
|
|
6755
|
+
});
|
|
6756
|
+
}
|
|
6757
|
+
catch (err1) {
|
|
6758
|
+
console.error('getResetVerificationCode err1:');
|
|
6759
|
+
console.error(err1);
|
|
6760
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
6761
|
+
}
|
|
6762
|
+
console.log('retValue:');
|
|
6763
|
+
console.log(JSON.stringify(retValue, null, 2));
|
|
6764
|
+
return retValue;
|
|
6765
|
+
}
|
|
6766
|
+
async verifyCode(input) {
|
|
6767
|
+
console.log('HEADERS:');
|
|
6768
|
+
console.log(JSON.stringify(this.headers, null, 2));
|
|
6769
|
+
const client = (0, client_1.createClient)({
|
|
6770
|
+
url: this.backendUrl + '/graphql',
|
|
6771
|
+
headers: this.headers,
|
|
6772
|
+
});
|
|
6773
|
+
let retValue = {};
|
|
6774
|
+
const fields = {
|
|
6775
|
+
result: true,
|
|
6776
|
+
code: {
|
|
6777
|
+
_id: true,
|
|
6778
|
+
type: true,
|
|
6779
|
+
recipient: true,
|
|
6780
|
+
expires: true,
|
|
6781
|
+
isExpired: true,
|
|
6782
|
+
createdDate: true,
|
|
6783
|
+
},
|
|
6784
|
+
error: {
|
|
6785
|
+
errorCode: true,
|
|
6786
|
+
errorMessage: true,
|
|
6787
|
+
}
|
|
6788
|
+
};
|
|
6789
|
+
try {
|
|
6790
|
+
const response = await client.query({
|
|
6791
|
+
verifyCode: {
|
|
6792
|
+
__args: {
|
|
6793
|
+
input: input
|
|
6794
|
+
},
|
|
6795
|
+
...fields
|
|
6796
|
+
},
|
|
6797
|
+
});
|
|
6798
|
+
console.log('verifyCode Response:');
|
|
6799
|
+
console.log(JSON.stringify(response, null, 2));
|
|
6800
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'verifyCode', (r) => {
|
|
6801
|
+
const isResponseOk = response?.verifyCode?.result === 'success' || response?.verifyCode?.result === 'error';
|
|
6802
|
+
return isResponseOk;
|
|
6803
|
+
});
|
|
6804
|
+
}
|
|
6805
|
+
catch (err1) {
|
|
6806
|
+
console.error('verifyCode err1:');
|
|
6807
|
+
console.error(err1);
|
|
6808
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
6809
|
+
}
|
|
6810
|
+
console.log('retValue:');
|
|
6811
|
+
console.log(JSON.stringify(retValue, null, 2));
|
|
6812
|
+
return retValue;
|
|
6813
|
+
}
|
|
6814
|
+
async resetUserPassword(input) {
|
|
6815
|
+
console.log('HEADERS:');
|
|
6816
|
+
console.log(JSON.stringify(this.headers, null, 2));
|
|
6817
|
+
const client = (0, client_1.createClient)({
|
|
6818
|
+
url: this.backendUrl + '/graphql',
|
|
6819
|
+
headers: this.headers,
|
|
6820
|
+
});
|
|
6821
|
+
let retValue = {};
|
|
6822
|
+
const fields = {
|
|
6823
|
+
field: true,
|
|
6824
|
+
changed: true,
|
|
6825
|
+
};
|
|
6826
|
+
try {
|
|
6827
|
+
const response = await client.mutation({
|
|
6828
|
+
resetUserPassword: {
|
|
6829
|
+
__args: {
|
|
6830
|
+
input: input
|
|
6831
|
+
},
|
|
6832
|
+
...fields
|
|
6833
|
+
},
|
|
6834
|
+
});
|
|
6835
|
+
console.log('resetUserPassword Response:');
|
|
6836
|
+
console.log(JSON.stringify(response, null, 2));
|
|
6837
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'resetUserPassword', (r) => {
|
|
6838
|
+
const isResponseOk = response?.resetUserPassword?.changed;
|
|
6839
|
+
;
|
|
6840
|
+
return isResponseOk;
|
|
6841
|
+
});
|
|
6842
|
+
}
|
|
6843
|
+
catch (err1) {
|
|
6844
|
+
console.error('resetUserPassword err1:');
|
|
6845
|
+
console.error(err1);
|
|
6846
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
6847
|
+
}
|
|
6848
|
+
console.log('retValue:');
|
|
6849
|
+
console.log(JSON.stringify(retValue, null, 2));
|
|
6850
|
+
return retValue;
|
|
6851
|
+
}
|
|
6852
|
+
async deleteAlbumFotos(dto) {
|
|
6853
|
+
console.log('HEADERS:');
|
|
6854
|
+
console.log(JSON.stringify(this.headers, null, 2));
|
|
6855
|
+
const client = (0, client_1.createClient)({
|
|
6856
|
+
url: this.backendUrl + '/graphql',
|
|
6857
|
+
headers: this.headers,
|
|
6858
|
+
});
|
|
6859
|
+
let retValue = {};
|
|
6860
|
+
const fields = {
|
|
6861
|
+
deleted: true,
|
|
6862
|
+
failedToDelete: true,
|
|
6863
|
+
failureReason: {
|
|
6864
|
+
code: true,
|
|
6865
|
+
message: true
|
|
6866
|
+
},
|
|
6867
|
+
result: true,
|
|
6868
|
+
};
|
|
6869
|
+
try {
|
|
6870
|
+
const response = await client.mutation({
|
|
6871
|
+
deleteAthletePhotos: {
|
|
6872
|
+
__args: {
|
|
6873
|
+
input: dto
|
|
6874
|
+
},
|
|
6875
|
+
...fields
|
|
6876
|
+
},
|
|
6877
|
+
});
|
|
6878
|
+
console.log('deleteAthletePhotos Response:');
|
|
6879
|
+
console.log(JSON.stringify(response, null, 2));
|
|
6880
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'deleteAthletePhotos', (r) => {
|
|
6881
|
+
const isResponseOk = response?.deleteAthletePhotos?.deleted.length > 0;
|
|
6882
|
+
return isResponseOk;
|
|
6883
|
+
});
|
|
6884
|
+
}
|
|
6885
|
+
catch (err1) {
|
|
6886
|
+
console.error('deleteAthletePhotos err1:');
|
|
6887
|
+
console.error(err1);
|
|
6888
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
6889
|
+
}
|
|
6890
|
+
console.log('retValue:');
|
|
6891
|
+
console.log(JSON.stringify(retValue, null, 2));
|
|
6892
|
+
return retValue;
|
|
6893
|
+
}
|
|
6368
6894
|
}
|
|
6369
6895
|
exports.VTXBaseAPI = VTXBaseAPI;
|
|
6370
6896
|
VTXBaseAPI.Logger = {
|