@vertikalx/vtx-backend-client 1.0.0-dev.90 → 1.0.0-dev.92
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 +17 -4
- package/src/api/vtx-base-api.js +667 -44
- package/src/api/vtx-base-api.js.map +1 -1
- package/src/client/schema.d.ts +262 -64
- package/src/client/schema.js +72 -23
- package/src/client/schema.js.map +1 -1
- package/src/client/types.d.ts +116 -27
- package/src/client/types.js +427 -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,7 +5728,7 @@ class VTXBaseAPI {
|
|
|
5707
5728
|
}
|
|
5708
5729
|
return retValue;
|
|
5709
5730
|
}
|
|
5710
|
-
async
|
|
5731
|
+
async addAlbumsPictures(dto) {
|
|
5711
5732
|
console.log('HEADERS:');
|
|
5712
5733
|
console.log(JSON.stringify(this.headers, null, 2));
|
|
5713
5734
|
const client = (0, client_1.createClient)({
|
|
@@ -5716,37 +5737,40 @@ class VTXBaseAPI {
|
|
|
5716
5737
|
});
|
|
5717
5738
|
let retValue = {};
|
|
5718
5739
|
const fields = {
|
|
5719
|
-
|
|
5720
|
-
|
|
5740
|
+
added: true,
|
|
5741
|
+
failedToAdd: true,
|
|
5721
5742
|
failureReason: {
|
|
5722
5743
|
code: true,
|
|
5723
5744
|
message: true
|
|
5724
|
-
}
|
|
5745
|
+
},
|
|
5746
|
+
result: true,
|
|
5725
5747
|
};
|
|
5726
5748
|
try {
|
|
5727
5749
|
const response = await client.mutation({
|
|
5728
|
-
|
|
5750
|
+
AddAlbumPictures: {
|
|
5729
5751
|
__args: {
|
|
5730
|
-
input:
|
|
5752
|
+
input: dto
|
|
5731
5753
|
},
|
|
5732
5754
|
...fields
|
|
5733
5755
|
},
|
|
5734
5756
|
});
|
|
5735
|
-
|
|
5736
|
-
|
|
5737
|
-
retValue = (0, response_builder_1.buildResponse)(response, '
|
|
5738
|
-
const isResponseOk =
|
|
5757
|
+
console.log('AddAlbumsPictures Response:');
|
|
5758
|
+
console.log(JSON.stringify(response, null, 2));
|
|
5759
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'AddAlbumPictures', (r) => {
|
|
5760
|
+
const isResponseOk = response?.AddAlbumPictures?.result === 'success' || response?.AddAlbumPictures?.result === 'partial';
|
|
5739
5761
|
return isResponseOk;
|
|
5740
5762
|
});
|
|
5741
5763
|
}
|
|
5742
5764
|
catch (err1) {
|
|
5743
|
-
|
|
5744
|
-
|
|
5765
|
+
console.error('addPictures err1:');
|
|
5766
|
+
console.error(err1);
|
|
5745
5767
|
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
5746
5768
|
}
|
|
5769
|
+
console.log('retValue:');
|
|
5770
|
+
console.log(JSON.stringify(retValue, null, 2));
|
|
5747
5771
|
return retValue;
|
|
5748
5772
|
}
|
|
5749
|
-
async
|
|
5773
|
+
async editAlbumsPictures(dto) {
|
|
5750
5774
|
console.log('HEADERS:');
|
|
5751
5775
|
console.log(JSON.stringify(this.headers, null, 2));
|
|
5752
5776
|
const client = (0, client_1.createClient)({
|
|
@@ -5755,32 +5779,38 @@ class VTXBaseAPI {
|
|
|
5755
5779
|
});
|
|
5756
5780
|
let retValue = {};
|
|
5757
5781
|
const fields = {
|
|
5758
|
-
|
|
5759
|
-
|
|
5760
|
-
|
|
5761
|
-
|
|
5762
|
-
|
|
5763
|
-
|
|
5764
|
-
|
|
5782
|
+
label: true,
|
|
5783
|
+
description: true,
|
|
5784
|
+
photos: {
|
|
5785
|
+
_id: true,
|
|
5786
|
+
photo: {
|
|
5787
|
+
_id: true,
|
|
5788
|
+
name: true,
|
|
5789
|
+
contentType: true,
|
|
5790
|
+
size: true,
|
|
5791
|
+
useType: true,
|
|
5792
|
+
url: true,
|
|
5793
|
+
}
|
|
5794
|
+
}
|
|
5765
5795
|
};
|
|
5766
5796
|
try {
|
|
5767
5797
|
const response = await client.mutation({
|
|
5768
|
-
|
|
5798
|
+
editAlbum: {
|
|
5769
5799
|
__args: {
|
|
5770
5800
|
input: dto
|
|
5771
5801
|
},
|
|
5772
5802
|
...fields
|
|
5773
5803
|
},
|
|
5774
5804
|
});
|
|
5775
|
-
console.log('
|
|
5805
|
+
console.log('editAlbum Response:');
|
|
5776
5806
|
console.log(JSON.stringify(response, null, 2));
|
|
5777
|
-
retValue = (0, response_builder_1.buildResponse)(response, '
|
|
5778
|
-
const isResponseOk = response?.
|
|
5807
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'editAlbum', (r) => {
|
|
5808
|
+
const isResponseOk = response?.editAlbum?.label;
|
|
5779
5809
|
return isResponseOk;
|
|
5780
5810
|
});
|
|
5781
5811
|
}
|
|
5782
5812
|
catch (err1) {
|
|
5783
|
-
console.error('
|
|
5813
|
+
console.error('editAlbum err1:');
|
|
5784
5814
|
console.error(err1);
|
|
5785
5815
|
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
5786
5816
|
}
|
|
@@ -5823,7 +5853,7 @@ class VTXBaseAPI {
|
|
|
5823
5853
|
console.log('createAthleteAlbum Response:');
|
|
5824
5854
|
console.log(JSON.stringify(response, null, 2));
|
|
5825
5855
|
retValue = (0, response_builder_1.buildResponse)(response, 'createAthleteAlbum', (r) => {
|
|
5826
|
-
const isResponseOk = response?.createAthleteAlbum?.
|
|
5856
|
+
const isResponseOk = response?.createAthleteAlbum?.label;
|
|
5827
5857
|
return isResponseOk;
|
|
5828
5858
|
});
|
|
5829
5859
|
}
|
|
@@ -5884,8 +5914,9 @@ class VTXBaseAPI {
|
|
|
5884
5914
|
url: this.backendUrl + '/graphql',
|
|
5885
5915
|
headers: this.headers,
|
|
5886
5916
|
});
|
|
5887
|
-
let retValue
|
|
5917
|
+
let retValue;
|
|
5888
5918
|
const fields = {
|
|
5919
|
+
_id: true,
|
|
5889
5920
|
label: true,
|
|
5890
5921
|
description: true,
|
|
5891
5922
|
photos: {
|
|
@@ -5910,7 +5941,7 @@ class VTXBaseAPI {
|
|
|
5910
5941
|
console.log('getAthleteAlbums Response:');
|
|
5911
5942
|
console.log(JSON.stringify(response, null, 2));
|
|
5912
5943
|
retValue = (0, response_builder_1.buildResponse)(response, 'getAthleteAlbums', (r) => {
|
|
5913
|
-
const isResponseOk = response?.getAthleteAlbums
|
|
5944
|
+
const isResponseOk = response?.getAthleteAlbums.length > 0;
|
|
5914
5945
|
return isResponseOk;
|
|
5915
5946
|
});
|
|
5916
5947
|
}
|
|
@@ -5923,7 +5954,56 @@ class VTXBaseAPI {
|
|
|
5923
5954
|
console.log(JSON.stringify(retValue, null, 2));
|
|
5924
5955
|
return retValue;
|
|
5925
5956
|
}
|
|
5926
|
-
async
|
|
5957
|
+
async getPublicAthleteAlbums(athleteId) {
|
|
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
|
+
getPublicAthleteAlbums: {
|
|
5984
|
+
__args: {
|
|
5985
|
+
athleteId: athleteId
|
|
5986
|
+
},
|
|
5987
|
+
...fields
|
|
5988
|
+
},
|
|
5989
|
+
});
|
|
5990
|
+
console.log('getPublicAthleteAlbums Response:');
|
|
5991
|
+
console.log(JSON.stringify(response, null, 2));
|
|
5992
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'getPublicAthleteAlbums', (r) => {
|
|
5993
|
+
const isResponseOk = response?.getPublicAthleteAlbums.length > 0;
|
|
5994
|
+
return isResponseOk;
|
|
5995
|
+
});
|
|
5996
|
+
}
|
|
5997
|
+
catch (err1) {
|
|
5998
|
+
console.error('getPublicAthleteAlbums err1:');
|
|
5999
|
+
console.error(err1);
|
|
6000
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
6001
|
+
}
|
|
6002
|
+
console.log('retValue:');
|
|
6003
|
+
console.log(JSON.stringify(retValue, null, 2));
|
|
6004
|
+
return retValue;
|
|
6005
|
+
}
|
|
6006
|
+
async getAthleteAlbumsById(albumId) {
|
|
5927
6007
|
console.log('HEADERS:');
|
|
5928
6008
|
console.log(JSON.stringify(this.headers, null, 2));
|
|
5929
6009
|
const client = (0, client_1.createClient)({
|
|
@@ -5948,20 +6028,71 @@ class VTXBaseAPI {
|
|
|
5948
6028
|
};
|
|
5949
6029
|
try {
|
|
5950
6030
|
const response = await client.query({
|
|
5951
|
-
|
|
5952
|
-
__args: {
|
|
6031
|
+
getAthleteAlbumId: {
|
|
6032
|
+
__args: {
|
|
6033
|
+
input: albumId
|
|
6034
|
+
},
|
|
5953
6035
|
...fields
|
|
5954
6036
|
},
|
|
5955
6037
|
});
|
|
5956
|
-
console.log('
|
|
6038
|
+
console.log('getAthleteAlbumId Response:');
|
|
5957
6039
|
console.log(JSON.stringify(response, null, 2));
|
|
5958
|
-
retValue = (0, response_builder_1.buildResponse)(response, '
|
|
5959
|
-
const isResponseOk = response?.
|
|
6040
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'getAthleteAlbumId', (r) => {
|
|
6041
|
+
const isResponseOk = response?.getAthleteAlbumId?._id;
|
|
5960
6042
|
return isResponseOk;
|
|
5961
6043
|
});
|
|
5962
6044
|
}
|
|
5963
6045
|
catch (err1) {
|
|
5964
|
-
console.error('
|
|
6046
|
+
console.error('getAthleteAlbumId err1:');
|
|
6047
|
+
console.error(err1);
|
|
6048
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
6049
|
+
}
|
|
6050
|
+
console.log('retValue:');
|
|
6051
|
+
console.log(JSON.stringify(retValue, null, 2));
|
|
6052
|
+
return retValue;
|
|
6053
|
+
}
|
|
6054
|
+
async getAndSetAlbumById(albumId) {
|
|
6055
|
+
console.log('HEADERS:');
|
|
6056
|
+
console.log(JSON.stringify(this.headers, null, 2));
|
|
6057
|
+
const client = (0, client_1.createClient)({
|
|
6058
|
+
url: this.backendUrl + '/graphql',
|
|
6059
|
+
headers: this.headers,
|
|
6060
|
+
});
|
|
6061
|
+
let retValue = {};
|
|
6062
|
+
const fields = {
|
|
6063
|
+
_id: true,
|
|
6064
|
+
label: true,
|
|
6065
|
+
description: true,
|
|
6066
|
+
photos: {
|
|
6067
|
+
_id: true,
|
|
6068
|
+
photo: {
|
|
6069
|
+
_id: true,
|
|
6070
|
+
name: true,
|
|
6071
|
+
contentType: true,
|
|
6072
|
+
size: true,
|
|
6073
|
+
useType: true,
|
|
6074
|
+
url: true,
|
|
6075
|
+
}
|
|
6076
|
+
}
|
|
6077
|
+
};
|
|
6078
|
+
try {
|
|
6079
|
+
const response = await client.query({
|
|
6080
|
+
getAndSetAlbumById: {
|
|
6081
|
+
__args: {
|
|
6082
|
+
input: albumId
|
|
6083
|
+
},
|
|
6084
|
+
...fields
|
|
6085
|
+
},
|
|
6086
|
+
});
|
|
6087
|
+
console.log('getAndSetAlbumById Response:');
|
|
6088
|
+
console.log(JSON.stringify(response, null, 2));
|
|
6089
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'getAndSetAlbumById', (r) => {
|
|
6090
|
+
const isResponseOk = response?.getAndSetAlbumById?._id;
|
|
6091
|
+
return isResponseOk;
|
|
6092
|
+
});
|
|
6093
|
+
}
|
|
6094
|
+
catch (err1) {
|
|
6095
|
+
console.error('getAndSetAlbumById err1:');
|
|
5965
6096
|
console.error(err1);
|
|
5966
6097
|
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
5967
6098
|
}
|
|
@@ -6261,6 +6392,72 @@ class VTXBaseAPI {
|
|
|
6261
6392
|
return retValue;
|
|
6262
6393
|
}
|
|
6263
6394
|
async getAthleteIntegrationsByAthlete() {
|
|
6395
|
+
const client = (0, client_1.createClient)({
|
|
6396
|
+
url: this.backendUrl + '/graphql',
|
|
6397
|
+
headers: this.headers,
|
|
6398
|
+
});
|
|
6399
|
+
let retValue = {};
|
|
6400
|
+
const fields = {
|
|
6401
|
+
_id: true,
|
|
6402
|
+
athlete: {
|
|
6403
|
+
_id: true,
|
|
6404
|
+
},
|
|
6405
|
+
hasInstagramIntegration: true,
|
|
6406
|
+
instagramTokenExpires: true,
|
|
6407
|
+
instagramUserData: {
|
|
6408
|
+
user_id: true,
|
|
6409
|
+
username: true,
|
|
6410
|
+
name: true,
|
|
6411
|
+
account_type: true,
|
|
6412
|
+
followers_count: true,
|
|
6413
|
+
media_count: true
|
|
6414
|
+
},
|
|
6415
|
+
instagramMediaData: {
|
|
6416
|
+
data: {
|
|
6417
|
+
id: true,
|
|
6418
|
+
caption: true,
|
|
6419
|
+
media_type: true,
|
|
6420
|
+
media_url: true,
|
|
6421
|
+
permalink: true,
|
|
6422
|
+
thumbnail_url: true,
|
|
6423
|
+
timestamp: true,
|
|
6424
|
+
username: true,
|
|
6425
|
+
like_count: true,
|
|
6426
|
+
comments_count: true,
|
|
6427
|
+
insights: {
|
|
6428
|
+
data: {
|
|
6429
|
+
name: true,
|
|
6430
|
+
period: true,
|
|
6431
|
+
values: true
|
|
6432
|
+
}
|
|
6433
|
+
}
|
|
6434
|
+
},
|
|
6435
|
+
paging: {
|
|
6436
|
+
cursors: {
|
|
6437
|
+
before: true,
|
|
6438
|
+
after: true
|
|
6439
|
+
},
|
|
6440
|
+
next: true
|
|
6441
|
+
}
|
|
6442
|
+
}
|
|
6443
|
+
};
|
|
6444
|
+
try {
|
|
6445
|
+
const response = await client.query({
|
|
6446
|
+
getAthleteInstagramIntegration: {
|
|
6447
|
+
...fields
|
|
6448
|
+
},
|
|
6449
|
+
});
|
|
6450
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'getAthleteInstagramIntegration', (r) => {
|
|
6451
|
+
const isResponseOk = !!response?.getAthleteInstagramIntegration?._id;
|
|
6452
|
+
return isResponseOk;
|
|
6453
|
+
});
|
|
6454
|
+
}
|
|
6455
|
+
catch (err) {
|
|
6456
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err);
|
|
6457
|
+
}
|
|
6458
|
+
return retValue;
|
|
6459
|
+
}
|
|
6460
|
+
async getAthleteStravaIntegration() {
|
|
6264
6461
|
const client = (0, client_1.createClient)({
|
|
6265
6462
|
url: this.backendUrl + '/graphql',
|
|
6266
6463
|
headers: this.headers,
|
|
@@ -6292,12 +6489,12 @@ class VTXBaseAPI {
|
|
|
6292
6489
|
};
|
|
6293
6490
|
try {
|
|
6294
6491
|
const response = await client.query({
|
|
6295
|
-
|
|
6492
|
+
getAthleteStravaIntegration: {
|
|
6296
6493
|
...fields
|
|
6297
6494
|
},
|
|
6298
6495
|
});
|
|
6299
|
-
retValue = (0, response_builder_1.buildResponse)(response, '
|
|
6300
|
-
const isResponseOk = !!response?.
|
|
6496
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'getAthleteStravaIntegration', (r) => {
|
|
6497
|
+
const isResponseOk = !!response?.getAthleteStravaIntegration?._id;
|
|
6301
6498
|
return isResponseOk;
|
|
6302
6499
|
});
|
|
6303
6500
|
}
|
|
@@ -6306,7 +6503,157 @@ class VTXBaseAPI {
|
|
|
6306
6503
|
}
|
|
6307
6504
|
return retValue;
|
|
6308
6505
|
}
|
|
6309
|
-
async
|
|
6506
|
+
async getAthleteInstagramIntegration() {
|
|
6507
|
+
const client = (0, client_1.createClient)({
|
|
6508
|
+
url: this.backendUrl + '/graphql',
|
|
6509
|
+
headers: this.headers,
|
|
6510
|
+
});
|
|
6511
|
+
let retValue = {};
|
|
6512
|
+
const fields = {
|
|
6513
|
+
_id: true,
|
|
6514
|
+
athlete: {
|
|
6515
|
+
_id: true,
|
|
6516
|
+
},
|
|
6517
|
+
hasInstagramIntegration: true,
|
|
6518
|
+
instagramTokenExpires: true,
|
|
6519
|
+
instagramUserData: {
|
|
6520
|
+
user_id: true,
|
|
6521
|
+
username: true,
|
|
6522
|
+
name: true,
|
|
6523
|
+
account_type: true,
|
|
6524
|
+
followers_count: true,
|
|
6525
|
+
media_count: true
|
|
6526
|
+
},
|
|
6527
|
+
instagramMediaData: {
|
|
6528
|
+
data: {
|
|
6529
|
+
id: true,
|
|
6530
|
+
caption: true,
|
|
6531
|
+
media_type: true,
|
|
6532
|
+
media_url: true,
|
|
6533
|
+
permalink: true,
|
|
6534
|
+
thumbnail_url: true,
|
|
6535
|
+
timestamp: true,
|
|
6536
|
+
username: true,
|
|
6537
|
+
like_count: true,
|
|
6538
|
+
comments_count: true,
|
|
6539
|
+
insights: {
|
|
6540
|
+
data: {
|
|
6541
|
+
name: true,
|
|
6542
|
+
period: true,
|
|
6543
|
+
values: true
|
|
6544
|
+
}
|
|
6545
|
+
}
|
|
6546
|
+
},
|
|
6547
|
+
paging: {
|
|
6548
|
+
cursors: {
|
|
6549
|
+
before: true,
|
|
6550
|
+
after: true
|
|
6551
|
+
},
|
|
6552
|
+
next: true
|
|
6553
|
+
}
|
|
6554
|
+
}
|
|
6555
|
+
};
|
|
6556
|
+
try {
|
|
6557
|
+
const response = await client.query({
|
|
6558
|
+
getAthleteInstagramIntegration: {
|
|
6559
|
+
...fields
|
|
6560
|
+
},
|
|
6561
|
+
});
|
|
6562
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'getAthleteInstagramIntegration', (r) => {
|
|
6563
|
+
const isResponseOk = !!response?.getAthleteInstagramIntegration?._id;
|
|
6564
|
+
return isResponseOk;
|
|
6565
|
+
});
|
|
6566
|
+
}
|
|
6567
|
+
catch (err) {
|
|
6568
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err);
|
|
6569
|
+
}
|
|
6570
|
+
return retValue;
|
|
6571
|
+
}
|
|
6572
|
+
async getAthleteIntegrations() {
|
|
6573
|
+
const client = (0, client_1.createClient)({
|
|
6574
|
+
url: this.backendUrl + '/graphql',
|
|
6575
|
+
headers: this.headers,
|
|
6576
|
+
});
|
|
6577
|
+
let retValue = {};
|
|
6578
|
+
const fields = {
|
|
6579
|
+
_id: true,
|
|
6580
|
+
athlete: {
|
|
6581
|
+
_id: true,
|
|
6582
|
+
},
|
|
6583
|
+
hasStravaIntegration: true,
|
|
6584
|
+
stravaTokenExpires: true,
|
|
6585
|
+
stravaAthleteData: {
|
|
6586
|
+
id: true,
|
|
6587
|
+
username: true,
|
|
6588
|
+
firstname: true,
|
|
6589
|
+
lastname: true,
|
|
6590
|
+
bio: true,
|
|
6591
|
+
city: true,
|
|
6592
|
+
state: true,
|
|
6593
|
+
country: true,
|
|
6594
|
+
sex: true,
|
|
6595
|
+
premium: true,
|
|
6596
|
+
profile: true,
|
|
6597
|
+
created_at: true,
|
|
6598
|
+
updated_at: true,
|
|
6599
|
+
weight: true
|
|
6600
|
+
},
|
|
6601
|
+
hasInstagramIntegration: true,
|
|
6602
|
+
instagramTokenExpires: true,
|
|
6603
|
+
instagramUserData: {
|
|
6604
|
+
user_id: true,
|
|
6605
|
+
username: true,
|
|
6606
|
+
name: true,
|
|
6607
|
+
account_type: true,
|
|
6608
|
+
followers_count: true,
|
|
6609
|
+
media_count: true
|
|
6610
|
+
},
|
|
6611
|
+
instagramMediaData: {
|
|
6612
|
+
data: {
|
|
6613
|
+
id: true,
|
|
6614
|
+
caption: true,
|
|
6615
|
+
media_type: true,
|
|
6616
|
+
media_url: true,
|
|
6617
|
+
permalink: true,
|
|
6618
|
+
thumbnail_url: true,
|
|
6619
|
+
timestamp: true,
|
|
6620
|
+
username: true,
|
|
6621
|
+
like_count: true,
|
|
6622
|
+
comments_count: true,
|
|
6623
|
+
insights: {
|
|
6624
|
+
data: {
|
|
6625
|
+
name: true,
|
|
6626
|
+
period: true,
|
|
6627
|
+
values: true
|
|
6628
|
+
}
|
|
6629
|
+
}
|
|
6630
|
+
},
|
|
6631
|
+
paging: {
|
|
6632
|
+
cursors: {
|
|
6633
|
+
before: true,
|
|
6634
|
+
after: true
|
|
6635
|
+
},
|
|
6636
|
+
next: true
|
|
6637
|
+
}
|
|
6638
|
+
}
|
|
6639
|
+
};
|
|
6640
|
+
try {
|
|
6641
|
+
const response = await client.query({
|
|
6642
|
+
getAthleteIntegrations: {
|
|
6643
|
+
...fields
|
|
6644
|
+
},
|
|
6645
|
+
});
|
|
6646
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'getAthleteIntegrations', (r) => {
|
|
6647
|
+
const isResponseOk = !!response?.getAthleteIntegrations?._id;
|
|
6648
|
+
return isResponseOk;
|
|
6649
|
+
});
|
|
6650
|
+
}
|
|
6651
|
+
catch (err) {
|
|
6652
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err);
|
|
6653
|
+
}
|
|
6654
|
+
return retValue;
|
|
6655
|
+
}
|
|
6656
|
+
async updateAthleteIntegration(type) {
|
|
6310
6657
|
const client = (0, client_1.createClient)({
|
|
6311
6658
|
url: this.backendUrl + '/graphql',
|
|
6312
6659
|
headers: this.headers,
|
|
@@ -6314,10 +6661,14 @@ class VTXBaseAPI {
|
|
|
6314
6661
|
let retValue = {};
|
|
6315
6662
|
try {
|
|
6316
6663
|
const response = await client.mutation({
|
|
6317
|
-
|
|
6664
|
+
updateAthleteIntegration: {
|
|
6665
|
+
__args: {
|
|
6666
|
+
type: type
|
|
6667
|
+
},
|
|
6668
|
+
}
|
|
6318
6669
|
});
|
|
6319
|
-
retValue = (0, response_builder_1.buildResponse)(response, '
|
|
6320
|
-
const isResponseOk = response?.
|
|
6670
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'updateAthleteIntegration', (r) => {
|
|
6671
|
+
const isResponseOk = response?.updateAthleteIntegration === true;
|
|
6321
6672
|
return isResponseOk;
|
|
6322
6673
|
});
|
|
6323
6674
|
}
|
|
@@ -6365,6 +6716,278 @@ class VTXBaseAPI {
|
|
|
6365
6716
|
console.log(JSON.stringify(retValue, null, 2));
|
|
6366
6717
|
return retValue;
|
|
6367
6718
|
}
|
|
6719
|
+
async saveAthleteCompetitionResult(dto) {
|
|
6720
|
+
const client = (0, client_1.createClient)({
|
|
6721
|
+
url: this.backendUrl + '/graphql',
|
|
6722
|
+
headers: this.headers,
|
|
6723
|
+
});
|
|
6724
|
+
let retValue = {};
|
|
6725
|
+
const fields = {
|
|
6726
|
+
_id: true,
|
|
6727
|
+
resultType: true,
|
|
6728
|
+
position: true,
|
|
6729
|
+
score: true,
|
|
6730
|
+
finishTimeMS: true,
|
|
6731
|
+
resultWebLink: true,
|
|
6732
|
+
};
|
|
6733
|
+
try {
|
|
6734
|
+
const response = await client.mutation({
|
|
6735
|
+
saveAthleteCompetitionResult: {
|
|
6736
|
+
__args: {
|
|
6737
|
+
input: dto
|
|
6738
|
+
},
|
|
6739
|
+
...fields
|
|
6740
|
+
},
|
|
6741
|
+
});
|
|
6742
|
+
VTXBaseAPI.Logger.debug('saveAthleteCompetitionResult Response:');
|
|
6743
|
+
VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
|
|
6744
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'saveAthleteCompetitionResult', (r) => {
|
|
6745
|
+
const isResponseOk = true && response?.saveAthleteCompetitionResult?._id;
|
|
6746
|
+
return isResponseOk;
|
|
6747
|
+
});
|
|
6748
|
+
}
|
|
6749
|
+
catch (err1) {
|
|
6750
|
+
VTXBaseAPI.Logger.error('saveAthleteCompetitionResult err1:');
|
|
6751
|
+
VTXBaseAPI.Logger.error(err1);
|
|
6752
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
6753
|
+
}
|
|
6754
|
+
return retValue;
|
|
6755
|
+
}
|
|
6756
|
+
async updateAthleteTpiScore() {
|
|
6757
|
+
const client = (0, client_1.createClient)({
|
|
6758
|
+
url: this.backendUrl + '/graphql',
|
|
6759
|
+
headers: this.headers,
|
|
6760
|
+
});
|
|
6761
|
+
let retValue = {};
|
|
6762
|
+
try {
|
|
6763
|
+
const response = await client.mutation({
|
|
6764
|
+
updateAthleteTpiScore: {
|
|
6765
|
+
_id: true,
|
|
6766
|
+
firstName: true,
|
|
6767
|
+
lastName: true,
|
|
6768
|
+
scores: {
|
|
6769
|
+
vtxScore: true,
|
|
6770
|
+
socialScore: true,
|
|
6771
|
+
trainingScore: true
|
|
6772
|
+
}
|
|
6773
|
+
},
|
|
6774
|
+
});
|
|
6775
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'updateAthleteTpiScore', (r) => {
|
|
6776
|
+
const isResponseOk = !!response?.updateAthleteTpiScore?._id;
|
|
6777
|
+
return isResponseOk;
|
|
6778
|
+
});
|
|
6779
|
+
}
|
|
6780
|
+
catch (err) {
|
|
6781
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err);
|
|
6782
|
+
}
|
|
6783
|
+
return retValue;
|
|
6784
|
+
}
|
|
6785
|
+
async createResetPasswordCode(email) {
|
|
6786
|
+
console.log('HEADERS:');
|
|
6787
|
+
console.log(JSON.stringify(this.headers, null, 2));
|
|
6788
|
+
const client = (0, client_1.createClient)({
|
|
6789
|
+
url: this.backendUrl + '/graphql',
|
|
6790
|
+
headers: this.headers,
|
|
6791
|
+
});
|
|
6792
|
+
let retValue = {};
|
|
6793
|
+
const fields = {
|
|
6794
|
+
field: true,
|
|
6795
|
+
changed: true,
|
|
6796
|
+
};
|
|
6797
|
+
try {
|
|
6798
|
+
const response = await client.mutation({
|
|
6799
|
+
createResetPasswordCode: {
|
|
6800
|
+
__args: {
|
|
6801
|
+
input: email
|
|
6802
|
+
},
|
|
6803
|
+
...fields
|
|
6804
|
+
},
|
|
6805
|
+
});
|
|
6806
|
+
console.log('createResetPasswordCode Response:');
|
|
6807
|
+
console.log(JSON.stringify(response, null, 2));
|
|
6808
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'createResetPasswordCode', (r) => {
|
|
6809
|
+
const isResponseOk = response?.createResetPasswordCode?.field !== null;
|
|
6810
|
+
return isResponseOk;
|
|
6811
|
+
});
|
|
6812
|
+
}
|
|
6813
|
+
catch (err1) {
|
|
6814
|
+
console.error('createResetPasswordCode err1:');
|
|
6815
|
+
console.error(err1);
|
|
6816
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
6817
|
+
}
|
|
6818
|
+
console.log('retValue:');
|
|
6819
|
+
console.log(JSON.stringify(retValue, null, 2));
|
|
6820
|
+
return retValue;
|
|
6821
|
+
}
|
|
6822
|
+
async getResetVerificationCode(id) {
|
|
6823
|
+
console.log('HEADERS:');
|
|
6824
|
+
console.log(JSON.stringify(this.headers, null, 2));
|
|
6825
|
+
const client = (0, client_1.createClient)({
|
|
6826
|
+
url: this.backendUrl + '/graphql',
|
|
6827
|
+
headers: this.headers,
|
|
6828
|
+
});
|
|
6829
|
+
let retValue = {};
|
|
6830
|
+
const fields = {
|
|
6831
|
+
_id: true,
|
|
6832
|
+
type: true,
|
|
6833
|
+
recipient: true,
|
|
6834
|
+
expires: true,
|
|
6835
|
+
isExpired: true,
|
|
6836
|
+
createdDate: true,
|
|
6837
|
+
};
|
|
6838
|
+
try {
|
|
6839
|
+
const response = await client.query({
|
|
6840
|
+
getResetVerificationCode: {
|
|
6841
|
+
__args: {
|
|
6842
|
+
input: id
|
|
6843
|
+
},
|
|
6844
|
+
...fields
|
|
6845
|
+
},
|
|
6846
|
+
});
|
|
6847
|
+
console.log('getResetVerificationCode Response:');
|
|
6848
|
+
console.log(JSON.stringify(response, null, 2));
|
|
6849
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'getResetVerificationCode', (r) => {
|
|
6850
|
+
const isResponseOk = response?.getResetVerificationCode?.changed;
|
|
6851
|
+
return isResponseOk;
|
|
6852
|
+
});
|
|
6853
|
+
}
|
|
6854
|
+
catch (err1) {
|
|
6855
|
+
console.error('getResetVerificationCode err1:');
|
|
6856
|
+
console.error(err1);
|
|
6857
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
6858
|
+
}
|
|
6859
|
+
console.log('retValue:');
|
|
6860
|
+
console.log(JSON.stringify(retValue, null, 2));
|
|
6861
|
+
return retValue;
|
|
6862
|
+
}
|
|
6863
|
+
async verifyCode(input) {
|
|
6864
|
+
console.log('HEADERS:');
|
|
6865
|
+
console.log(JSON.stringify(this.headers, null, 2));
|
|
6866
|
+
const client = (0, client_1.createClient)({
|
|
6867
|
+
url: this.backendUrl + '/graphql',
|
|
6868
|
+
headers: this.headers,
|
|
6869
|
+
});
|
|
6870
|
+
let retValue = {};
|
|
6871
|
+
const fields = {
|
|
6872
|
+
result: true,
|
|
6873
|
+
code: {
|
|
6874
|
+
_id: true,
|
|
6875
|
+
type: true,
|
|
6876
|
+
recipient: true,
|
|
6877
|
+
expires: true,
|
|
6878
|
+
isExpired: true,
|
|
6879
|
+
createdDate: true,
|
|
6880
|
+
},
|
|
6881
|
+
error: {
|
|
6882
|
+
errorCode: true,
|
|
6883
|
+
errorMessage: true,
|
|
6884
|
+
}
|
|
6885
|
+
};
|
|
6886
|
+
try {
|
|
6887
|
+
const response = await client.query({
|
|
6888
|
+
verifyCode: {
|
|
6889
|
+
__args: {
|
|
6890
|
+
input: input
|
|
6891
|
+
},
|
|
6892
|
+
...fields
|
|
6893
|
+
},
|
|
6894
|
+
});
|
|
6895
|
+
console.log('verifyCode Response:');
|
|
6896
|
+
console.log(JSON.stringify(response, null, 2));
|
|
6897
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'verifyCode', (r) => {
|
|
6898
|
+
const isResponseOk = response?.verifyCode?.result === 'success' || response?.verifyCode?.result === 'error';
|
|
6899
|
+
return isResponseOk;
|
|
6900
|
+
});
|
|
6901
|
+
}
|
|
6902
|
+
catch (err1) {
|
|
6903
|
+
console.error('verifyCode err1:');
|
|
6904
|
+
console.error(err1);
|
|
6905
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
6906
|
+
}
|
|
6907
|
+
console.log('retValue:');
|
|
6908
|
+
console.log(JSON.stringify(retValue, null, 2));
|
|
6909
|
+
return retValue;
|
|
6910
|
+
}
|
|
6911
|
+
async resetUserPassword(input) {
|
|
6912
|
+
console.log('HEADERS:');
|
|
6913
|
+
console.log(JSON.stringify(this.headers, null, 2));
|
|
6914
|
+
const client = (0, client_1.createClient)({
|
|
6915
|
+
url: this.backendUrl + '/graphql',
|
|
6916
|
+
headers: this.headers,
|
|
6917
|
+
});
|
|
6918
|
+
let retValue = {};
|
|
6919
|
+
const fields = {
|
|
6920
|
+
field: true,
|
|
6921
|
+
changed: true,
|
|
6922
|
+
};
|
|
6923
|
+
try {
|
|
6924
|
+
const response = await client.mutation({
|
|
6925
|
+
resetUserPassword: {
|
|
6926
|
+
__args: {
|
|
6927
|
+
input: input
|
|
6928
|
+
},
|
|
6929
|
+
...fields
|
|
6930
|
+
},
|
|
6931
|
+
});
|
|
6932
|
+
console.log('resetUserPassword Response:');
|
|
6933
|
+
console.log(JSON.stringify(response, null, 2));
|
|
6934
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'resetUserPassword', (r) => {
|
|
6935
|
+
const isResponseOk = response?.resetUserPassword?.changed;
|
|
6936
|
+
;
|
|
6937
|
+
return isResponseOk;
|
|
6938
|
+
});
|
|
6939
|
+
}
|
|
6940
|
+
catch (err1) {
|
|
6941
|
+
console.error('resetUserPassword err1:');
|
|
6942
|
+
console.error(err1);
|
|
6943
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
6944
|
+
}
|
|
6945
|
+
console.log('retValue:');
|
|
6946
|
+
console.log(JSON.stringify(retValue, null, 2));
|
|
6947
|
+
return retValue;
|
|
6948
|
+
}
|
|
6949
|
+
async deleteAlbumFotos(dto) {
|
|
6950
|
+
console.log('HEADERS:');
|
|
6951
|
+
console.log(JSON.stringify(this.headers, null, 2));
|
|
6952
|
+
const client = (0, client_1.createClient)({
|
|
6953
|
+
url: this.backendUrl + '/graphql',
|
|
6954
|
+
headers: this.headers,
|
|
6955
|
+
});
|
|
6956
|
+
let retValue = {};
|
|
6957
|
+
const fields = {
|
|
6958
|
+
deleted: true,
|
|
6959
|
+
failedToDelete: true,
|
|
6960
|
+
failureReason: {
|
|
6961
|
+
code: true,
|
|
6962
|
+
message: true
|
|
6963
|
+
},
|
|
6964
|
+
result: true,
|
|
6965
|
+
};
|
|
6966
|
+
try {
|
|
6967
|
+
const response = await client.mutation({
|
|
6968
|
+
deleteAthletePhotos: {
|
|
6969
|
+
__args: {
|
|
6970
|
+
input: dto
|
|
6971
|
+
},
|
|
6972
|
+
...fields
|
|
6973
|
+
},
|
|
6974
|
+
});
|
|
6975
|
+
console.log('deleteAthletePhotos Response:');
|
|
6976
|
+
console.log(JSON.stringify(response, null, 2));
|
|
6977
|
+
retValue = (0, response_builder_1.buildResponse)(response, 'deleteAthletePhotos', (r) => {
|
|
6978
|
+
const isResponseOk = response?.deleteAthletePhotos?.deleted.length > 0;
|
|
6979
|
+
return isResponseOk;
|
|
6980
|
+
});
|
|
6981
|
+
}
|
|
6982
|
+
catch (err1) {
|
|
6983
|
+
console.error('deleteAthletePhotos err1:');
|
|
6984
|
+
console.error(err1);
|
|
6985
|
+
retValue = (0, response_builder_1.buildErrorResponse)(err1);
|
|
6986
|
+
}
|
|
6987
|
+
console.log('retValue:');
|
|
6988
|
+
console.log(JSON.stringify(retValue, null, 2));
|
|
6989
|
+
return retValue;
|
|
6990
|
+
}
|
|
6368
6991
|
}
|
|
6369
6992
|
exports.VTXBaseAPI = VTXBaseAPI;
|
|
6370
6993
|
VTXBaseAPI.Logger = {
|