@vertikalx/vtx-backend-client 3.0.0-dev.15 → 3.0.0-dev.17

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vertikalx/vtx-backend-client",
3
- "version": "3.0.0-dev.15",
3
+ "version": "3.0.0-dev.17",
4
4
  "description": "GraphQL API generated client for VTX",
5
5
  "types": "src/index.d.ts",
6
6
  "main": "src/index.js",
@@ -1,4 +1,4 @@
1
- import { User, AddValuesResponse, UserToken, UserWithToken, Athlete, RegisterAthleteDto, Brand, CreateBrandDto, BrandGenqlSelection, AWSS3UploadUrl, AWSS3GetUploadDto, CreateTenantInput, Tenant, TenantWithUserLogin, RegisterUserToDomainFromEmailInput, DecodedToken, Sponsorship, SponsorshipGenqlSelection, CreateSponsorshipDto, SponsorAthleteInvitation, InviteAthletesDto, RegisterUserDto, VerificationCode, VerifyCodeDto, FindSponsorAthleteInvitationDto, FindVtxUserDto, City, SportLevel, Sport, UserImages, EditValueResponse, CreateAthleteCompetitionDto, AthleteCompetition, GetSportEventsDto, SportsEvent, CreateSportEventDto, GetAthleteCompetitionsDto, AthleteMembership, AthleteMembershipGenqlSelection, MembershipOrganizationReferenceGenqlSelection, MembershipOrganizationReference, CreateMembershipOrganizationDto, CreateAthleteMembershipDto, DeleteSingleValueDto, DeleteSingleValueResponse, FundRaisingCampaign, CreateFundingCampaignDto, FundRaisingCampaignGenqlSelection, AthleteQueryDto, AthleteQueryResponse, StripeSessionGenqlSelection, CreateStripeAccountDto, StripeSession, StripeAccountReferenceGenqlSelection, StripeAccountReference, StripeCheckoutSessionGenqlSelection, StripeCheckoutSession, DonationCheckoutDto, GetDatabaseFileDto, TextDatabaseFileGenqlSelection, TextDatabaseFile, StripeQueryDto, StripeObject, SetFundingStatusDto, EditPictureResponse, UploadAlbumsPicturesDto, EditPictureDto, Album, State, Country, AWSS3DeleteUseTypeKeyDto, AthleteIntegrationReference, AWSS3CallResult, SetCompetitionResultDto, AthleteCompetitionResult, CodeVerificationResponse, resetPasswordDto, DeleteValuesDto, existValueDto, ExistValueResponse, Receipt, ReceiptUrl, GetReceiptDto, DeleteValuesResponse, BudgetData, AddCompetitionBudgetDto, EditCompetitionBudgetDto, EditCampaignBudgetDto, SetCurrentCampaignDto, GetAthleteCampaignsDto, UpdateFundingCampaignDto, EditDisplayIndexDto, MergeEventsResponse, MergeSportsEventsDto, BudgetConcept, BudgetItemUnit, CompetitionDeleteVerificationResponse, RegisterMemberDto, Member, Donation, GetHistoricalScoresDto, HistoricalScore, GetMyHistoricalScoresDto, HistoricalScoresPeriod, GetTransactionDetailsDto, TransactionDetails, TransactionDetailsGenqlSelection } from '../client';
1
+ import { User, AddValuesResponse, UserToken, UserWithToken, Athlete, RegisterAthleteDto, Brand, CreateBrandDto, BrandGenqlSelection, AWSS3UploadUrl, AWSS3GetUploadDto, CreateTenantInput, Tenant, TenantWithUserLogin, RegisterUserToDomainFromEmailInput, DecodedToken, Sponsorship, SponsorshipGenqlSelection, CreateSponsorshipDto, SponsorAthleteInvitation, InviteAthletesDto, RegisterUserDto, VerificationCode, VerifyCodeDto, FindSponsorAthleteInvitationDto, FindVtxUserDto, City, SportLevel, Sport, UserImages, EditValueResponse, CreateAthleteCompetitionDto, AthleteCompetition, GetSportEventsDto, SportsEvent, CreateSportEventDto, GetAthleteCompetitionsDto, AthleteMembership, AthleteMembershipGenqlSelection, MembershipOrganizationReferenceGenqlSelection, MembershipOrganizationReference, CreateMembershipOrganizationDto, CreateAthleteMembershipDto, DeleteSingleValueDto, DeleteSingleValueResponse, FundRaisingCampaign, CreateFundingCampaignDto, FundRaisingCampaignGenqlSelection, AthleteQueryDto, AthleteQueryResponse, StripeSessionGenqlSelection, CreateStripeAccountDto, StripeSession, StripeAccountReferenceGenqlSelection, StripeAccountReference, StripeCheckoutSessionGenqlSelection, StripeCheckoutSession, DonationCheckoutDto, GetDatabaseFileDto, TextDatabaseFileGenqlSelection, TextDatabaseFile, StripeQueryDto, StripeObject, SetFundingStatusDto, EditPictureResponse, UploadAlbumsPicturesDto, UpdateUserSuspendedStatusDto, EditPictureDto, Album, State, Country, AWSS3DeleteUseTypeKeyDto, AthleteIntegrationReference, AWSS3CallResult, SetCompetitionResultDto, AthleteCompetitionResult, CodeVerificationResponse, resetPasswordDto, DeleteValuesDto, existValueDto, ExistValueResponse, Receipt, ReceiptUrl, GetReceiptDto, DeleteValuesResponse, BudgetData, AddCompetitionBudgetDto, EditCompetitionBudgetDto, EditCampaignBudgetDto, SetCurrentCampaignDto, GetAthleteCampaignsDto, UpdateFundingCampaignDto, EditDisplayIndexDto, MergeEventsResponse, MergeSportsEventsDto, BudgetConcept, BudgetItemUnit, CompetitionDeleteVerificationResponse, RegisterMemberDto, Member, Donation, DonationGenqlSelection, GetHistoricalScoresDto, HistoricalScore, GetMyHistoricalScoresDto, HistoricalScoresPeriod, GetTransactionDetailsDto, TransactionDetails, TransactionDetailsGenqlSelection, AdminUserView, AdminTransactionView, PaginatedTransactionsType, TransactionQueryDto, PaginatedUsersType, UserQueryDto } from '../client';
2
2
  import { ITypedBackendResponse } from './backend-response';
3
3
  import { APICallHeaders } from './api-call-headers';
4
4
  import { VerificationCodeType } from '@vertikalx/common-types';
@@ -119,7 +119,7 @@ export declare class VTXBaseAPI {
119
119
  editCampaignBudget(input: EditCampaignBudgetDto): Promise<ITypedBackendResponse<Boolean>>;
120
120
  editCompetitionBudgetForCampaign(input: EditCampaignBudgetDto): Promise<ITypedBackendResponse<Boolean>>;
121
121
  getDonationsByAthlete(): Promise<ITypedBackendResponse<Receipt[]>>;
122
- getDonationsByMember(): Promise<ITypedBackendResponse<Donation[]>>;
122
+ getDonationsByMember(desiredFields?: DonationGenqlSelection): Promise<ITypedBackendResponse<Donation[]>>;
123
123
  findMemberForUser(loginEmail: string): Promise<ITypedBackendResponse<Member>>;
124
124
  getBudgetConcepts(): Promise<ITypedBackendResponse<BudgetConcept[]>>;
125
125
  getBudgetItemsUnits(): Promise<ITypedBackendResponse<BudgetItemUnit[]>>;
@@ -133,4 +133,13 @@ export declare class VTXBaseAPI {
133
133
  getAthleteHistoricalScoresPeriod(dto: GetHistoricalScoresDto): Promise<ITypedBackendResponse<HistoricalScoresPeriod>>;
134
134
  getMyHistoricalScoresPeriod(dto: GetMyHistoricalScoresDto): Promise<ITypedBackendResponse<HistoricalScoresPeriod>>;
135
135
  getTransactionDetails(dto: GetTransactionDetailsDto, desiredFields?: TransactionDetailsGenqlSelection): Promise<ITypedBackendResponse<TransactionDetails>>;
136
+ getAllUsers(): Promise<ITypedBackendResponse<AdminUserView[]>>;
137
+ getAllTransactions(): Promise<ITypedBackendResponse<AdminTransactionView[]>>;
138
+ getTransactionsPaginated(args?: {
139
+ query?: TransactionQueryDto;
140
+ }): Promise<ITypedBackendResponse<PaginatedTransactionsType>>;
141
+ getUsersPaginated(args: {
142
+ query: UserQueryDto;
143
+ }): Promise<ITypedBackendResponse<PaginatedUsersType>>;
144
+ updateUserSuspendedStatus(input: UpdateUserSuspendedStatusDto): Promise<ITypedBackendResponse<EditValueResponse>>;
136
145
  }
@@ -8013,16 +8013,61 @@ class VTXBaseAPI {
8013
8013
  }
8014
8014
  return retValue;
8015
8015
  }
8016
- async getDonationsByMember() {
8016
+ async getDonationsByMember(desiredFields) {
8017
8017
  const client = (0, client_1.createClient)({
8018
8018
  url: this.backendUrl + '/graphql',
8019
8019
  headers: this.headers,
8020
8020
  });
8021
8021
  let retValue = { data: [] };
8022
- const fields = {
8022
+ const athleteSelection = {
8023
+ _id: true,
8024
+ firstName: true,
8025
+ lastName: true,
8026
+ screenName: true,
8027
+ competitionGender: true,
8028
+ country: {
8029
+ _id: true,
8030
+ name: true
8031
+ },
8032
+ location: {
8033
+ _id: true,
8034
+ city: {
8035
+ _id: true,
8036
+ name: true,
8037
+ state: {
8038
+ _id: true,
8039
+ name: true,
8040
+ country: {
8041
+ _id: true,
8042
+ name: true,
8043
+ }
8044
+ }
8045
+ }
8046
+ },
8047
+ mainSport: {
8048
+ _id: true,
8049
+ name: true,
8050
+ },
8051
+ mainSportLevel: {
8052
+ _id: true,
8053
+ label: true
8054
+ },
8055
+ profilePicture: {
8056
+ _id: true,
8057
+ name: true,
8058
+ contentType: true,
8059
+ size: true,
8060
+ useType: true,
8061
+ url: true,
8062
+ key: true
8063
+ }
8064
+ };
8065
+ const fields = desiredFields ?? {
8023
8066
  checkoutSessionId: true,
8024
8067
  fundingCheckoutSessionDataId: true,
8025
8068
  donationMode: true,
8069
+ donorName: true,
8070
+ donorEmail: true,
8026
8071
  completed: true,
8027
8072
  confirmed: true,
8028
8073
  donationAmount: true,
@@ -8031,9 +8076,24 @@ class VTXBaseAPI {
8031
8076
  athleteId: true,
8032
8077
  athleteName: true,
8033
8078
  message: true,
8079
+ athleteReference: athleteSelection,
8034
8080
  campaignReference: {
8035
8081
  _id: true,
8036
- title: true
8082
+ athlete: athleteSelection,
8083
+ status: true,
8084
+ title: true,
8085
+ motivation: true,
8086
+ website: true,
8087
+ fundsRequired: true,
8088
+ initialFundsObtained: true,
8089
+ fundsObtained: true,
8090
+ endingDate: true,
8091
+ video: {
8092
+ _id: true,
8093
+ source: true,
8094
+ url: true,
8095
+ sourceData: true
8096
+ }
8037
8097
  }
8038
8098
  };
8039
8099
  try {
@@ -8043,8 +8103,7 @@ class VTXBaseAPI {
8043
8103
  },
8044
8104
  });
8045
8105
  retValue = (0, response_builder_1.buildResponse)(response, 'getDonationsByMember', (r) => {
8046
- const isResponseOk = !!response?.getDonationsByMember &&
8047
- Array.isArray(response.getDonationsByMember);
8106
+ const isResponseOk = true && Array.isArray(response?.getDonationsByMember);
8048
8107
  return isResponseOk;
8049
8108
  });
8050
8109
  if (!retValue.data) {
@@ -8666,6 +8725,333 @@ class VTXBaseAPI {
8666
8725
  }
8667
8726
  return retValue;
8668
8727
  }
8728
+ async getAllUsers() {
8729
+ const client = (0, client_1.createClient)({
8730
+ url: this.backendUrl + "/graphql",
8731
+ headers: this.headers,
8732
+ });
8733
+ const fields = {
8734
+ _id: true,
8735
+ loginEmail: true,
8736
+ firstName: true,
8737
+ lastName: true,
8738
+ screenName: true,
8739
+ suspended: true,
8740
+ domains: {
8741
+ _id: true,
8742
+ name: true,
8743
+ description: true
8744
+ },
8745
+ athlete: {
8746
+ _id: true,
8747
+ firstName: true,
8748
+ lastName: true,
8749
+ screenName: true,
8750
+ dob: true,
8751
+ competitionGender: true,
8752
+ country: {
8753
+ _id: true,
8754
+ name: true
8755
+ },
8756
+ location: {
8757
+ _id: true,
8758
+ cityNameGeocode: true,
8759
+ stateNameGeocode: true,
8760
+ countryIso2CodeGeocode: true,
8761
+ city: {
8762
+ _id: true,
8763
+ name: true,
8764
+ localizedName: true,
8765
+ state: {
8766
+ _id: true,
8767
+ name: true,
8768
+ country: {
8769
+ _id: true,
8770
+ name: true
8771
+ }
8772
+ }
8773
+ }
8774
+ },
8775
+ mainSport: {
8776
+ _id: true,
8777
+ name: true
8778
+ },
8779
+ mainSportLevel: {
8780
+ _id: true,
8781
+ label: true
8782
+ },
8783
+ allSports: {
8784
+ _id: true,
8785
+ name: true
8786
+ }
8787
+ },
8788
+ member: {
8789
+ _id: true,
8790
+ fullName: true,
8791
+ screenName: true
8792
+ }
8793
+ };
8794
+ let retValue;
8795
+ try {
8796
+ const response = await client.query({
8797
+ getAllUsers: {
8798
+ __args: {},
8799
+ ...fields
8800
+ }
8801
+ });
8802
+ VTXBaseAPI.Logger.debug('getAllUsers Response:');
8803
+ VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
8804
+ retValue = (0, response_builder_1.buildResponse)(response, 'getAllUsers', (r) => {
8805
+ VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
8806
+ const isResponseOk = true;
8807
+ return isResponseOk;
8808
+ });
8809
+ }
8810
+ catch (err1) {
8811
+ VTXBaseAPI.Logger.error('getAllUsers err1:');
8812
+ VTXBaseAPI.Logger.error(err1);
8813
+ retValue = (0, response_builder_1.buildErrorResponse)(err1);
8814
+ }
8815
+ return retValue;
8816
+ }
8817
+ async getAllTransactions() {
8818
+ const client = (0, client_1.createClient)({
8819
+ url: this.backendUrl + "/graphql",
8820
+ headers: this.headers,
8821
+ });
8822
+ const fields = {
8823
+ _id: true,
8824
+ createdDate: true,
8825
+ stripeSessionId: true,
8826
+ concept: true,
8827
+ donationAmount: true,
8828
+ fromEmail: true,
8829
+ type: true,
8830
+ confirmed: true,
8831
+ completed: true,
8832
+ completedDate: true,
8833
+ stripeAccountId: true,
8834
+ fundingDetails: {
8835
+ paidToVtx: true,
8836
+ paidToAthlete: true,
8837
+ athleteId: true,
8838
+ athleteName: true,
8839
+ fromName: true,
8840
+ fromPhone: true,
8841
+ message: true,
8842
+ mode: true
8843
+ }
8844
+ };
8845
+ let retValue;
8846
+ try {
8847
+ const response = await client.query({
8848
+ getAllTransactions: {
8849
+ __args: {},
8850
+ ...fields
8851
+ }
8852
+ });
8853
+ VTXBaseAPI.Logger.debug('getAllTransactions Response:');
8854
+ VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
8855
+ retValue = (0, response_builder_1.buildResponse)(response, 'getAllTransactions', (r) => {
8856
+ VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
8857
+ const isResponseOk = true;
8858
+ return isResponseOk;
8859
+ });
8860
+ }
8861
+ catch (err1) {
8862
+ VTXBaseAPI.Logger.error('getAllTransactions err1:');
8863
+ VTXBaseAPI.Logger.error(err1);
8864
+ retValue = (0, response_builder_1.buildErrorResponse)(err1);
8865
+ }
8866
+ return retValue;
8867
+ }
8868
+ async getTransactionsPaginated(args = {}) {
8869
+ const client = (0, client_1.createClient)({
8870
+ url: this.backendUrl + "/graphql",
8871
+ headers: this.headers,
8872
+ });
8873
+ const fields = {
8874
+ items: {
8875
+ _id: true,
8876
+ createdDate: true,
8877
+ stripeSessionId: true,
8878
+ donationAmount: true,
8879
+ fromEmail: true,
8880
+ type: true,
8881
+ confirmed: true,
8882
+ completed: true,
8883
+ completedDate: true,
8884
+ stripeAccountId: true,
8885
+ fundingDetails: {
8886
+ paidToVtx: true,
8887
+ paidToAthlete: true,
8888
+ athleteId: true,
8889
+ athleteName: true,
8890
+ fromName: true,
8891
+ fromPhone: true,
8892
+ message: true,
8893
+ mode: true
8894
+ }
8895
+ },
8896
+ pagination: {
8897
+ currentPage: true,
8898
+ totalPages: true,
8899
+ totalItems: true,
8900
+ itemsPerPage: true,
8901
+ hasNextPage: true,
8902
+ hasPreviousPage: true
8903
+ }
8904
+ };
8905
+ let retValue;
8906
+ try {
8907
+ const response = await client.query({
8908
+ getTransactionsPaginated: {
8909
+ __args: args,
8910
+ ...fields
8911
+ }
8912
+ });
8913
+ VTXBaseAPI.Logger.debug('getTransactionsPaginated Response:');
8914
+ VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
8915
+ retValue = (0, response_builder_1.buildResponse)(response, 'getTransactionsPaginated', (r) => {
8916
+ VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
8917
+ const isResponseOk = true;
8918
+ return isResponseOk;
8919
+ });
8920
+ }
8921
+ catch (err1) {
8922
+ VTXBaseAPI.Logger.error('getTransactionsPaginated err1:');
8923
+ VTXBaseAPI.Logger.error(err1);
8924
+ retValue = (0, response_builder_1.buildErrorResponse)(err1);
8925
+ }
8926
+ return retValue;
8927
+ }
8928
+ async getUsersPaginated(args) {
8929
+ const client = (0, client_1.createClient)({
8930
+ url: this.backendUrl + "/graphql",
8931
+ headers: this.headers,
8932
+ });
8933
+ const fields = {
8934
+ items: {
8935
+ _id: true,
8936
+ loginEmail: true,
8937
+ firstName: true,
8938
+ lastName: true,
8939
+ screenName: true,
8940
+ suspended: true,
8941
+ domains: {
8942
+ _id: true,
8943
+ name: true,
8944
+ description: true
8945
+ },
8946
+ athlete: {
8947
+ _id: true,
8948
+ mainSport: {
8949
+ _id: true,
8950
+ name: true
8951
+ },
8952
+ mainSportLevel: {
8953
+ _id: true,
8954
+ label: true
8955
+ },
8956
+ competitionGender: true,
8957
+ dob: true,
8958
+ country: {
8959
+ _id: true,
8960
+ name: true
8961
+ },
8962
+ location: {
8963
+ city: {
8964
+ _id: true,
8965
+ name: true,
8966
+ state: {
8967
+ _id: true,
8968
+ name: true,
8969
+ country: {
8970
+ _id: true,
8971
+ name: true
8972
+ }
8973
+ }
8974
+ },
8975
+ cityNameGeocode: true,
8976
+ stateNameGeocode: true
8977
+ },
8978
+ aboutMe: true,
8979
+ allSports: {
8980
+ _id: true,
8981
+ name: true
8982
+ }
8983
+ },
8984
+ member: {
8985
+ _id: true
8986
+ }
8987
+ },
8988
+ pagination: {
8989
+ currentPage: true,
8990
+ totalPages: true,
8991
+ totalItems: true,
8992
+ itemsPerPage: true,
8993
+ hasNextPage: true,
8994
+ hasPreviousPage: true
8995
+ }
8996
+ };
8997
+ let retValue;
8998
+ try {
8999
+ const response = await client.query({
9000
+ getUsersPaginated: {
9001
+ __args: args,
9002
+ ...fields
9003
+ }
9004
+ });
9005
+ VTXBaseAPI.Logger.debug('getUsersPaginated Response:');
9006
+ VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
9007
+ retValue = (0, response_builder_1.buildResponse)(response, 'getUsersPaginated', (r) => {
9008
+ VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
9009
+ const isResponseOk = true;
9010
+ return isResponseOk;
9011
+ });
9012
+ }
9013
+ catch (err1) {
9014
+ VTXBaseAPI.Logger.error('getUsersPaginated err1:');
9015
+ VTXBaseAPI.Logger.error(err1);
9016
+ retValue = (0, response_builder_1.buildErrorResponse)(err1);
9017
+ }
9018
+ return retValue;
9019
+ }
9020
+ async updateUserSuspendedStatus(input) {
9021
+ const client = (0, client_1.createClient)({
9022
+ url: this.backendUrl + '/graphql',
9023
+ headers: this.headers,
9024
+ });
9025
+ let retValue = {};
9026
+ const fields = {
9027
+ field: true,
9028
+ changed: true,
9029
+ oldValue: true,
9030
+ newValue: true,
9031
+ };
9032
+ try {
9033
+ const response = await client.mutation({
9034
+ updateUserSuspendedStatus: {
9035
+ __args: {
9036
+ input: input
9037
+ },
9038
+ ...fields
9039
+ },
9040
+ });
9041
+ VTXBaseAPI.Logger.debug('updateUserSuspendedStatus Response:');
9042
+ VTXBaseAPI.Logger.debug(JSON.stringify(response, null, 2));
9043
+ retValue = (0, response_builder_1.buildResponse)(response, 'updateUserSuspendedStatus', (r) => {
9044
+ const isResponseOk = response?.updateUserSuspendedStatus?.field !== null;
9045
+ return isResponseOk;
9046
+ });
9047
+ }
9048
+ catch (err1) {
9049
+ VTXBaseAPI.Logger.error('updateUserSuspendedStatus err1:');
9050
+ VTXBaseAPI.Logger.error(err1);
9051
+ retValue = (0, response_builder_1.buildErrorResponse)(err1);
9052
+ }
9053
+ return retValue;
9054
+ }
8669
9055
  }
8670
9056
  exports.VTXBaseAPI = VTXBaseAPI;
8671
9057
  VTXBaseAPI.Logger = {