Skip to content

Commit

Permalink
update GraphQL syntax to fetch orders
Browse files Browse the repository at this point in the history
oppositeAccount instead of searchTerm
  • Loading branch information
znarf committed Apr 16, 2024
1 parent b3ece41 commit b52aad2
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 2 deletions.
60 changes: 60 additions & 0 deletions src/graphql/schemaV2.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,11 @@ interface Account {
Same as onlySubscriptions, but returns only orders with active subscriptions
"""
onlyActiveSubscriptions: Boolean

"""
Return only orders made from/to that opposite account (only works when orders are already filtered with a main account)
"""
oppositeAccount: AccountReferenceInput
): OrderCollection!
expenses(
direction: ExpenseDirection
Expand Down Expand Up @@ -2180,6 +2185,11 @@ type Host implements Account & AccountWithContributions {
Same as onlySubscriptions, but returns only orders with active subscriptions
"""
onlyActiveSubscriptions: Boolean

"""
Return only orders made from/to that opposite account (only works when orders are already filtered with a main account)
"""
oppositeAccount: AccountReferenceInput
): OrderCollection!
expenses(
direction: ExpenseDirection
Expand Down Expand Up @@ -4380,6 +4390,11 @@ type PaymentMethod {
Same as onlySubscriptions, but returns only orders with active subscriptions
"""
onlyActiveSubscriptions: Boolean

"""
Return only orders made from/to that opposite account (only works when orders are already filtered with a main account)
"""
oppositeAccount: AccountReferenceInput
): OrderCollection
}

Expand Down Expand Up @@ -7159,6 +7174,11 @@ type Bot implements Account {
Same as onlySubscriptions, but returns only orders with active subscriptions
"""
onlyActiveSubscriptions: Boolean

"""
Return only orders made from/to that opposite account (only works when orders are already filtered with a main account)
"""
oppositeAccount: AccountReferenceInput
): OrderCollection!
expenses(
direction: ExpenseDirection
Expand Down Expand Up @@ -7889,6 +7909,11 @@ type Collective implements Account & AccountWithHost & AccountWithContributions
Same as onlySubscriptions, but returns only orders with active subscriptions
"""
onlyActiveSubscriptions: Boolean

"""
Return only orders made from/to that opposite account (only works when orders are already filtered with a main account)
"""
oppositeAccount: AccountReferenceInput
): OrderCollection!
expenses(
direction: ExpenseDirection
Expand Down Expand Up @@ -9060,6 +9085,11 @@ type Event implements Account & AccountWithHost & AccountWithContributions & Acc
Same as onlySubscriptions, but returns only orders with active subscriptions
"""
onlyActiveSubscriptions: Boolean

"""
Return only orders made from/to that opposite account (only works when orders are already filtered with a main account)
"""
oppositeAccount: AccountReferenceInput
): OrderCollection!
expenses(
direction: ExpenseDirection
Expand Down Expand Up @@ -10020,6 +10050,11 @@ type Individual implements Account {
Same as onlySubscriptions, but returns only orders with active subscriptions
"""
onlyActiveSubscriptions: Boolean

"""
Return only orders made from/to that opposite account (only works when orders are already filtered with a main account)
"""
oppositeAccount: AccountReferenceInput
): OrderCollection!
expenses(
direction: ExpenseDirection
Expand Down Expand Up @@ -10956,6 +10991,11 @@ type Organization implements Account & AccountWithContributions {
Same as onlySubscriptions, but returns only orders with active subscriptions
"""
onlyActiveSubscriptions: Boolean

"""
Return only orders made from/to that opposite account (only works when orders are already filtered with a main account)
"""
oppositeAccount: AccountReferenceInput
): OrderCollection!
expenses(
direction: ExpenseDirection
Expand Down Expand Up @@ -11786,6 +11826,11 @@ type Vendor implements Account & AccountWithContributions {
Same as onlySubscriptions, but returns only orders with active subscriptions
"""
onlyActiveSubscriptions: Boolean

"""
Return only orders made from/to that opposite account (only works when orders are already filtered with a main account)
"""
oppositeAccount: AccountReferenceInput
): OrderCollection!
expenses(
direction: ExpenseDirection
Expand Down Expand Up @@ -12848,6 +12893,11 @@ type Query {
Same as onlySubscriptions, but returns only orders with active subscriptions
"""
onlyActiveSubscriptions: Boolean

"""
Return only orders made from/to that opposite account (only works when orders are already filtered with a main account)
"""
oppositeAccount: AccountReferenceInput
): OrderCollection!
organization(
"""
Expand Down Expand Up @@ -15057,6 +15107,11 @@ type Fund implements Account & AccountWithHost & AccountWithContributions {
Same as onlySubscriptions, but returns only orders with active subscriptions
"""
onlyActiveSubscriptions: Boolean

"""
Return only orders made from/to that opposite account (only works when orders are already filtered with a main account)
"""
oppositeAccount: AccountReferenceInput
): OrderCollection!
expenses(
direction: ExpenseDirection
Expand Down Expand Up @@ -15895,6 +15950,11 @@ type Project implements Account & AccountWithHost & AccountWithContributions & A
Same as onlySubscriptions, but returns only orders with active subscriptions
"""
onlyActiveSubscriptions: Boolean

"""
Return only orders made from/to that opposite account (only works when orders are already filtered with a main account)
"""
oppositeAccount: AccountReferenceInput
): OrderCollection!
expenses(
direction: ExpenseDirection
Expand Down
4 changes: 2 additions & 2 deletions src/server/controllers/account-contributors.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const contributorsQuery = gqlV2/* GraphQL */ `
email
}
activeRecurringContributions: orders(
searchTerm: $slug
oppositeAccount: { slug: $slug }
onlyActiveSubscriptions: true
orderBy: { field: CREATED_AT, direction: DESC }
) {
Expand All @@ -49,7 +49,7 @@ const contributorsQuery = gqlV2/* GraphQL */ `
}
}
pausedRecurringContributions: orders(
searchTerm: $slug
oppositeAccount: { slug: $slug }
status: PAUSED
orderBy: { field: CREATED_AT, direction: DESC }
) {
Expand Down

0 comments on commit b52aad2

Please sign in to comment.