Skip to content

Commit

Permalink
feat(TransactionQuery): Use transaction reference input as query argu…
Browse files Browse the repository at this point in the history
…ment
  • Loading branch information
gustavlrsn committed May 7, 2024
1 parent 58aecf5 commit 8c03f8b
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 15 deletions.
71 changes: 58 additions & 13 deletions server/graphql/schemaV2.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -3211,6 +3211,11 @@ type LegalDocument {
"""
service: LegalDocumentService!

"""
Whether this legal document is expired
"""
isExpired: Boolean!

Check notice on line 3217 in server/graphql/schemaV2.graphql

View workflow job for this annotation

GitHub Actions / GraphQL Inspector - Schema v2

Field 'isExpired' was added to object type 'LegalDocument'

Field 'isExpired' was added to object type 'LegalDocument'

"""
The date and time the request for this legal document was created
"""
Expand Down Expand Up @@ -6132,10 +6137,20 @@ type HostApplication {
"""
account: Account!

"""
The host the collective applied to
"""
host: Host!

Check notice on line 6143 in server/graphql/schemaV2.graphql

View workflow job for this annotation

GitHub Actions / GraphQL Inspector - Schema v2

Field 'host' was added to object type 'HostApplication'

Field 'host' was added to object type 'HostApplication'

"""
The date on which the item was created
"""
createdAt: DateTime!

"""
The date on which the item was updated
"""
updatedAt: DateTime!

Check notice on line 6153 in server/graphql/schemaV2.graphql

View workflow job for this annotation

GitHub Actions / GraphQL Inspector - Schema v2

Field 'updatedAt' was added to object type 'HostApplication'

Field 'updatedAt' was added to object type 'HostApplication'
status: HostApplicationStatus
message: String
customData: JSON
Expand Down Expand Up @@ -8393,6 +8408,11 @@ type Collective implements Account & AccountWithHost & AccountWithContributions
"""
hostFeePercent(paymentMethodService: PaymentMethodService, paymentMethodType: PaymentMethodType): Float

"""
Returns the Fiscal Host application
"""
hostApplication: HostApplication

Check notice on line 8414 in server/graphql/schemaV2.graphql

View workflow job for this annotation

GitHub Actions / GraphQL Inspector - Schema v2

Field 'hostApplication' was added to object type 'Collective'

Field 'hostApplication' was added to object type 'Collective'

"""
How much platform fees are charged for this account
"""
Expand Down Expand Up @@ -8496,6 +8516,11 @@ interface AccountWithHost {
"""
hostFeePercent(paymentMethodService: PaymentMethodService, paymentMethodType: PaymentMethodType): Float

"""
Returns the Fiscal Host application
"""
hostApplication: HostApplication

Check notice on line 8522 in server/graphql/schemaV2.graphql

View workflow job for this annotation

GitHub Actions / GraphQL Inspector - Schema v2

Field 'hostApplication' was added to interface 'AccountWithHost'

Field 'hostApplication' was added to interface 'AccountWithHost'

"""
Fees percentage that the platform takes for this collective
"""
Expand Down Expand Up @@ -9574,6 +9599,11 @@ type Event implements Account & AccountWithHost & AccountWithContributions & Acc
"""
hostFeePercent(paymentMethodService: PaymentMethodService, paymentMethodType: PaymentMethodType): Float

"""
Returns the Fiscal Host application
"""
hostApplication: HostApplication

Check notice on line 9605 in server/graphql/schemaV2.graphql

View workflow job for this annotation

GitHub Actions / GraphQL Inspector - Schema v2

Field 'hostApplication' was added to object type 'Event'

Field 'hostApplication' was added to object type 'Event'

"""
How much platform fees are charged for this account
"""
Expand Down Expand Up @@ -13160,7 +13190,12 @@ type Query {
"""
The public id identifying the transaction (ie: rvelja97-pkzqbgq7-bbzyx6wd-50o8n4rm)
"""
id: String
id: String @deprecated(reason: "2024-05-07: Please use the `transaction` field.")

"""
Identifiers to retrieve the transaction.
"""
transaction: TransactionReferenceInput

Check warning on line 13198 in server/graphql/schemaV2.graphql

View workflow job for this annotation

GitHub Actions / GraphQL Inspector - Schema v2

Argument 'transaction: TransactionReferenceInput' added to field 'Query.transaction'

Adding a new argument to an existing field may involve a change in resolve function logic that potentially may cause some side effects.
): Transaction
transactions(
"""
Expand Down Expand Up @@ -15617,6 +15652,11 @@ type Fund implements Account & AccountWithHost & AccountWithContributions {
"""
hostFeePercent(paymentMethodService: PaymentMethodService, paymentMethodType: PaymentMethodType): Float

"""
Returns the Fiscal Host application
"""
hostApplication: HostApplication

Check notice on line 15658 in server/graphql/schemaV2.graphql

View workflow job for this annotation

GitHub Actions / GraphQL Inspector - Schema v2

Field 'hostApplication' was added to object type 'Fund'

Field 'hostApplication' was added to object type 'Fund'

"""
How much platform fees are charged for this account
"""
Expand Down Expand Up @@ -16465,6 +16505,11 @@ type Project implements Account & AccountWithHost & AccountWithContributions & A
"""
hostFeePercent(paymentMethodService: PaymentMethodService, paymentMethodType: PaymentMethodType): Float

"""
Returns the Fiscal Host application
"""
hostApplication: HostApplication

Check notice on line 16511 in server/graphql/schemaV2.graphql

View workflow job for this annotation

GitHub Actions / GraphQL Inspector - Schema v2

Field 'hostApplication' was added to object type 'Project'

Field 'hostApplication' was added to object type 'Project'

"""
How much platform fees are charged for this account
"""
Expand Down Expand Up @@ -16571,6 +16616,18 @@ input TierReferenceInput {
isCustom: Boolean
}

input TransactionReferenceInput {
"""
The public id identifying the transaction (ie: dgm9bnk8-0437xqry-ejpvzeol-jdayw5re)
"""
id: String

"""
The internal id of the transaction (ie: 580)
"""
legacyId: Int
}

"""
A PayPal plan to associate with a contribution
"""
Expand Down Expand Up @@ -19981,18 +20038,6 @@ type BanAccountResponse {
accounts: [Account!]!
}

input TransactionReferenceInput {
"""
The public id identifying the transaction (ie: dgm9bnk8-0437xqry-ejpvzeol-jdayw5re)
"""
id: String

"""
The internal id of the transaction (ie: 580)
"""
legacyId: Int
}

"""
Input type for UpdateType
"""
Expand Down
12 changes: 10 additions & 2 deletions server/graphql/v2/query/TransactionQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { GraphQLString } from 'graphql';

import models from '../../../models';
import { NotFound } from '../../errors';
import { fetchTransactionWithReference, GraphQLTransactionReferenceInput } from '../input/TransactionReferenceInput';
import { GraphQLTransaction } from '../interface/Transaction';

const TransactionQuery = {
Expand All @@ -11,11 +12,18 @@ const TransactionQuery = {
id: {
type: GraphQLString,
description: 'The public id identifying the transaction (ie: rvelja97-pkzqbgq7-bbzyx6wd-50o8n4rm)',
deprecationReason: '2024-05-07: Please use the `transaction` field.',
},
transaction: {
type: GraphQLTransactionReferenceInput,
description: 'Identifiers to retrieve the transaction.',
},
},
async resolve(_, args) {
async resolve(_, args, req) {
let transaction;
if (args.id) {
if (args.transaction) {
transaction = await fetchTransactionWithReference(args.transaction, req);
} else if (args.id) {
transaction = await models.Transaction.findOne({ where: { uuid: args.id } });
} else {
return new Error('Please provide an id');
Expand Down

0 comments on commit 8c03f8b

Please sign in to comment.