From d4d176a6c9328b4ed2e5d966187323886fa2bb9c Mon Sep 17 00:00:00 2001 From: Siddharth Date: Mon, 23 Dec 2024 19:00:03 +0530 Subject: [PATCH] chore: remove customer object from withdraw and deposit (#1179) --- apps/admin-panel/app/actions/list.tsx | 3 - .../app/customers/[customer-id]/page.tsx | 4 +- .../[customer-id]/transactions/page.tsx | 36 ++-- apps/admin-panel/app/customers/list.tsx | 7 +- apps/admin-panel/app/deposits/create.tsx | 9 - apps/admin-panel/app/deposits/list.tsx | 3 - .../app/withdrawals/[withdrawal-id]/page.tsx | 9 +- apps/admin-panel/app/withdrawals/cancel.tsx | 9 - apps/admin-panel/app/withdrawals/confirm.tsx | 10 - apps/admin-panel/app/withdrawals/initiate.tsx | 9 - apps/admin-panel/app/withdrawals/list.tsx | 7 - .../lib/graphql/generated/index.ts | 172 +++++------------- .../lib/graphql/generated/mocks.ts | 60 +++--- 13 files changed, 97 insertions(+), 241 deletions(-) diff --git a/apps/admin-panel/app/actions/list.tsx b/apps/admin-panel/app/actions/list.tsx index b14b2b220..1f35c0d34 100644 --- a/apps/admin-panel/app/actions/list.tsx +++ b/apps/admin-panel/app/actions/list.tsx @@ -34,9 +34,6 @@ gql` __typename ... on Withdrawal { withdrawalId - customer { - email - } } ... on CreditFacility { creditFacilityId diff --git a/apps/admin-panel/app/customers/[customer-id]/page.tsx b/apps/admin-panel/app/customers/[customer-id]/page.tsx index 248d05510..1909a908f 100644 --- a/apps/admin-panel/app/customers/[customer-id]/page.tsx +++ b/apps/admin-panel/app/customers/[customer-id]/page.tsx @@ -12,8 +12,8 @@ gql` customer(id: $id) { id customerId - balance { - checking { + depositAccount { + balance { settled pending } diff --git a/apps/admin-panel/app/customers/[customer-id]/transactions/page.tsx b/apps/admin-panel/app/customers/[customer-id]/transactions/page.tsx index 828db0ae4..2719ddbb2 100644 --- a/apps/admin-panel/app/customers/[customer-id]/transactions/page.tsx +++ b/apps/admin-panel/app/customers/[customer-id]/transactions/page.tsx @@ -10,29 +10,24 @@ gql` query GetCustomerTransactions($id: UUID!) { customer(id: $id) { id - deposits { - createdAt - customerId - depositId - reference - amount - } - withdrawals { - status - reference - customerId - withdrawalId - createdAt - amount - customer { - customerId - email + depositAccount { + deposits { + createdAt + depositId + reference + amount + } + withdrawals { + status + reference + withdrawalId + createdAt + amount } } transactions @client { ... on Deposit { createdAt - customerId depositId reference amount @@ -40,14 +35,9 @@ gql` ... on Withdrawal { status reference - customerId withdrawalId createdAt amount - customer { - customerId - email - } } } } diff --git a/apps/admin-panel/app/customers/list.tsx b/apps/admin-panel/app/customers/list.tsx index 12d2db3a8..b0193b55f 100644 --- a/apps/admin-panel/app/customers/list.tsx +++ b/apps/admin-panel/app/customers/list.tsx @@ -37,15 +37,12 @@ gql` email telegramId applicantId - balance { - checking { + depositAccount { + balance { settled pending } } - - subjectCanRecordDeposit - subjectCanInitiateWithdrawal subjectCanCreateCreditFacility } cursor diff --git a/apps/admin-panel/app/deposits/create.tsx b/apps/admin-panel/app/deposits/create.tsx index 57c6fdd68..19d3c0bcf 100644 --- a/apps/admin-panel/app/deposits/create.tsx +++ b/apps/admin-panel/app/deposits/create.tsx @@ -29,15 +29,6 @@ gql` deposit { depositId amount - customer { - customerId - email - balance { - checking { - settled - } - } - } } } } diff --git a/apps/admin-panel/app/deposits/list.tsx b/apps/admin-panel/app/deposits/list.tsx index acf329aa1..5c81c638a 100644 --- a/apps/admin-panel/app/deposits/list.tsx +++ b/apps/admin-panel/app/deposits/list.tsx @@ -27,9 +27,6 @@ gql` depositId amount reference - customer { - email - } } } } diff --git a/apps/admin-panel/app/withdrawals/[withdrawal-id]/page.tsx b/apps/admin-panel/app/withdrawals/[withdrawal-id]/page.tsx index 07a05e0fb..be25c1338 100644 --- a/apps/admin-panel/app/withdrawals/[withdrawal-id]/page.tsx +++ b/apps/admin-panel/app/withdrawals/[withdrawal-id]/page.tsx @@ -9,18 +9,11 @@ import { DetailsPageSkeleton } from "@/components/details-page-skeleton" gql` query GetWithdrawalDetails($id: UUID!) { withdrawal(id: $id) { - customerId withdrawalId amount status reference - subjectCanConfirm - subjectCanCancel - customer { - email - customerId - applicantId - } + approvalProcess { approvalProcessId deniedReason diff --git a/apps/admin-panel/app/withdrawals/cancel.tsx b/apps/admin-panel/app/withdrawals/cancel.tsx index 213d326b2..b05f6bcfa 100644 --- a/apps/admin-panel/app/withdrawals/cancel.tsx +++ b/apps/admin-panel/app/withdrawals/cancel.tsx @@ -26,15 +26,6 @@ gql` withdrawal { withdrawalId amount - customer { - customerId - balance { - checking { - settled - pending - } - } - } } } } diff --git a/apps/admin-panel/app/withdrawals/confirm.tsx b/apps/admin-panel/app/withdrawals/confirm.tsx index f63eb3383..5613fbc82 100644 --- a/apps/admin-panel/app/withdrawals/confirm.tsx +++ b/apps/admin-panel/app/withdrawals/confirm.tsx @@ -28,16 +28,6 @@ gql` withdrawalId amount reference - customer { - customerId - email - balance { - checking { - settled - pending - } - } - } } } } diff --git a/apps/admin-panel/app/withdrawals/initiate.tsx b/apps/admin-panel/app/withdrawals/initiate.tsx index 94e2dba0a..7f7bbdc62 100644 --- a/apps/admin-panel/app/withdrawals/initiate.tsx +++ b/apps/admin-panel/app/withdrawals/initiate.tsx @@ -31,15 +31,6 @@ gql` withdrawal { withdrawalId amount - customer { - customerId - balance { - checking { - settled - pending - } - } - } } } } diff --git a/apps/admin-panel/app/withdrawals/list.tsx b/apps/admin-panel/app/withdrawals/list.tsx index f40b6263b..bbd86c8f0 100644 --- a/apps/admin-panel/app/withdrawals/list.tsx +++ b/apps/admin-panel/app/withdrawals/list.tsx @@ -26,17 +26,10 @@ gql` edges { cursor node { - customerId withdrawalId amount status reference - subjectCanConfirm - subjectCanCancel - customer { - customerId - email - } } } } diff --git a/apps/admin-panel/lib/graphql/generated/index.ts b/apps/admin-panel/lib/graphql/generated/index.ts index 9bc48ac2b..918c66fdd 100644 --- a/apps/admin-panel/lib/graphql/generated/index.ts +++ b/apps/admin-panel/lib/graphql/generated/index.ts @@ -239,12 +239,6 @@ export type ChartOfAccounts = { name: Scalars['String']['output']; }; -export type Checking = { - __typename?: 'Checking'; - pending: Scalars['UsdCents']['output']; - settled: Scalars['UsdCents']['output']; -}; - export type Collateral = { __typename?: 'Collateral'; btcBalance: Scalars['Satoshis']['output']; @@ -543,27 +537,18 @@ export enum CreditFacilityStatus { export type Customer = { __typename?: 'Customer'; applicantId?: Maybe; - balance: CustomerBalance; createdAt: Scalars['Timestamp']['output']; creditFacilities: Array; customerId: Scalars['UUID']['output']; - deposits: Array; + depositAccount: DepositAccount; documents: Array; email: Scalars['String']['output']; id: Scalars['ID']['output']; level: KycLevel; status: AccountStatus; subjectCanCreateCreditFacility: Scalars['Boolean']['output']; - subjectCanInitiateWithdrawal: Scalars['Boolean']['output']; - subjectCanRecordDeposit: Scalars['Boolean']['output']; telegramId: Scalars['String']['output']; transactions: Array; - withdrawals: Array; -}; - -export type CustomerBalance = { - __typename?: 'CustomerBalance'; - checking: Checking; }; export type CustomerConnection = { @@ -637,13 +622,30 @@ export type Deposit = { __typename?: 'Deposit'; amount: Scalars['UsdCents']['output']; createdAt: Scalars['Timestamp']['output']; - customer: Customer; - customerId: Scalars['UUID']['output']; + depositAccountId: Scalars['UUID']['output']; depositId: Scalars['UUID']['output']; id: Scalars['ID']['output']; reference: Scalars['String']['output']; }; +export type DepositAccount = { + __typename?: 'DepositAccount'; + balance: DepositAccountBalance; + createdAt: Scalars['Timestamp']['output']; + customer: Customer; + customerId: Scalars['UUID']['output']; + depositAccountId: Scalars['UUID']['output']; + deposits: Array; + id: Scalars['ID']['output']; + withdrawals: Array; +}; + +export type DepositAccountBalance = { + __typename?: 'DepositAccountBalance'; + pending: Scalars['UsdCents']['output']; + settled: Scalars['UsdCents']['output']; +}; + export type DepositConnection = { __typename?: 'DepositConnection'; /** A list of edges. */ @@ -665,7 +667,7 @@ export type DepositEdge = { export type DepositRecordInput = { amount: Scalars['UsdCents']['input']; - customerId: Scalars['UUID']['input']; + depositAccountId: Scalars['UUID']['input']; reference?: InputMaybe; }; @@ -1506,13 +1508,9 @@ export type Withdrawal = { approvalProcess: ApprovalProcess; approvalProcessId: Scalars['UUID']['output']; createdAt: Scalars['Timestamp']['output']; - customer: Customer; - customerId: Scalars['UUID']['output']; id: Scalars['ID']['output']; reference: Scalars['String']['output']; status: WithdrawalStatus; - subjectCanCancel: Scalars['Boolean']['output']; - subjectCanConfirm: Scalars['Boolean']['output']; withdrawalId: Scalars['UUID']['output']; }; @@ -1555,7 +1553,7 @@ export type WithdrawalEdge = { export type WithdrawalInitiateInput = { amount: Scalars['UsdCents']['input']; - customerId: Scalars['UUID']['input']; + depositAccountId: Scalars['UUID']['input']; reference?: InputMaybe; }; @@ -1590,7 +1588,7 @@ export type ApprovalProcessDenyMutation = { __typename?: 'Mutation', approvalPro export type AllActionsQueryVariables = Exact<{ [key: string]: never; }>; -export type AllActionsQuery = { __typename?: 'Query', approvalProcesses: { __typename?: 'ApprovalProcessConnection', pageInfo: { __typename?: 'PageInfo', hasNextPage: boolean, hasPreviousPage: boolean }, edges: Array<{ __typename?: 'ApprovalProcessEdge', cursor: string, node: { __typename?: 'ApprovalProcess', id: string, approvalProcessType: ApprovalProcessType, status: ApprovalProcessStatus, subjectCanSubmitDecision: boolean, createdAt: any, target: { __typename: 'CreditFacility', creditFacilityId: string, customer: { __typename?: 'Customer', email: string } } | { __typename: 'CreditFacilityDisbursal', id: string, index: any, disbursalId: string, creditFacility: { __typename?: 'CreditFacility', customer: { __typename?: 'Customer', email: string } } } | { __typename: 'Withdrawal', withdrawalId: string, customer: { __typename?: 'Customer', email: string } } } }> } }; +export type AllActionsQuery = { __typename?: 'Query', approvalProcesses: { __typename?: 'ApprovalProcessConnection', pageInfo: { __typename?: 'PageInfo', hasNextPage: boolean, hasPreviousPage: boolean }, edges: Array<{ __typename?: 'ApprovalProcessEdge', cursor: string, node: { __typename?: 'ApprovalProcess', id: string, approvalProcessType: ApprovalProcessType, status: ApprovalProcessStatus, subjectCanSubmitDecision: boolean, createdAt: any, target: { __typename: 'CreditFacility', creditFacilityId: string, customer: { __typename?: 'Customer', email: string } } | { __typename: 'CreditFacilityDisbursal', id: string, index: any, disbursalId: string, creditFacility: { __typename?: 'CreditFacility', customer: { __typename?: 'Customer', email: string } } } | { __typename: 'Withdrawal', withdrawalId: string } } }> } }; export type AuditLogsQueryVariables = Exact<{ first: Scalars['Int']['input']; @@ -1772,14 +1770,14 @@ export type GetCustomerOverviewQueryVariables = Exact<{ }>; -export type GetCustomerOverviewQuery = { __typename?: 'Query', customer?: { __typename?: 'Customer', id: string, customerId: string, balance: { __typename?: 'CustomerBalance', checking: { __typename?: 'Checking', settled: UsdCents, pending: UsdCents } } } | null }; +export type GetCustomerOverviewQuery = { __typename?: 'Query', customer?: { __typename?: 'Customer', id: string, customerId: string, depositAccount: { __typename?: 'DepositAccount', balance: { __typename?: 'DepositAccountBalance', settled: UsdCents, pending: UsdCents } } } | null }; export type GetCustomerTransactionsQueryVariables = Exact<{ id: Scalars['UUID']['input']; }>; -export type GetCustomerTransactionsQuery = { __typename?: 'Query', customer?: { __typename?: 'Customer', id: string, deposits: Array<{ __typename?: 'Deposit', createdAt: any, customerId: string, depositId: string, reference: string, amount: UsdCents }>, withdrawals: Array<{ __typename?: 'Withdrawal', status: WithdrawalStatus, reference: string, customerId: string, withdrawalId: string, createdAt: any, amount: UsdCents, customer: { __typename?: 'Customer', customerId: string, email: string } }>, transactions: Array<{ __typename?: 'Deposit', createdAt: any, customerId: string, depositId: string, reference: string, amount: UsdCents } | { __typename?: 'Withdrawal', status: WithdrawalStatus, reference: string, customerId: string, withdrawalId: string, createdAt: any, amount: UsdCents, customer: { __typename?: 'Customer', customerId: string, email: string } }> } | null }; +export type GetCustomerTransactionsQuery = { __typename?: 'Query', customer?: { __typename?: 'Customer', id: string, depositAccount: { __typename?: 'DepositAccount', deposits: Array<{ __typename?: 'Deposit', createdAt: any, depositId: string, reference: string, amount: UsdCents }>, withdrawals: Array<{ __typename?: 'Withdrawal', status: WithdrawalStatus, reference: string, withdrawalId: string, createdAt: any, amount: UsdCents }> }, transactions: Array<{ __typename?: 'Deposit', createdAt: any, depositId: string, reference: string, amount: UsdCents } | { __typename?: 'Withdrawal', status: WithdrawalStatus, reference: string, withdrawalId: string, createdAt: any, amount: UsdCents }> } | null }; export type CustomerUpdateMutationVariables = Exact<{ input: CustomerUpdateInput; @@ -1803,7 +1801,7 @@ export type CustomersQueryVariables = Exact<{ }>; -export type CustomersQuery = { __typename?: 'Query', customers: { __typename?: 'CustomerConnection', edges: Array<{ __typename?: 'CustomerEdge', cursor: string, node: { __typename?: 'Customer', id: string, customerId: string, status: AccountStatus, level: KycLevel, email: string, telegramId: string, applicantId?: string | null, subjectCanRecordDeposit: boolean, subjectCanInitiateWithdrawal: boolean, subjectCanCreateCreditFacility: boolean, balance: { __typename?: 'CustomerBalance', checking: { __typename?: 'Checking', settled: UsdCents, pending: UsdCents } } } }>, pageInfo: { __typename?: 'PageInfo', endCursor?: string | null, startCursor?: string | null, hasNextPage: boolean, hasPreviousPage: boolean } } }; +export type CustomersQuery = { __typename?: 'Query', customers: { __typename?: 'CustomerConnection', edges: Array<{ __typename?: 'CustomerEdge', cursor: string, node: { __typename?: 'Customer', id: string, customerId: string, status: AccountStatus, level: KycLevel, email: string, telegramId: string, applicantId?: string | null, subjectCanCreateCreditFacility: boolean, depositAccount: { __typename?: 'DepositAccount', balance: { __typename?: 'DepositAccountBalance', settled: UsdCents, pending: UsdCents } } } }>, pageInfo: { __typename?: 'PageInfo', endCursor?: string | null, startCursor?: string | null, hasNextPage: boolean, hasPreviousPage: boolean } } }; export type DashboardQueryVariables = Exact<{ [key: string]: never; }>; @@ -1815,7 +1813,7 @@ export type CreateDepositMutationVariables = Exact<{ }>; -export type CreateDepositMutation = { __typename?: 'Mutation', depositRecord: { __typename?: 'DepositRecordPayload', deposit: { __typename?: 'Deposit', depositId: string, amount: UsdCents, customer: { __typename?: 'Customer', customerId: string, email: string, balance: { __typename?: 'CustomerBalance', checking: { __typename?: 'Checking', settled: UsdCents } } } } } }; +export type CreateDepositMutation = { __typename?: 'Mutation', depositRecord: { __typename?: 'DepositRecordPayload', deposit: { __typename?: 'Deposit', depositId: string, amount: UsdCents } } }; export type DepositsQueryVariables = Exact<{ first: Scalars['Int']['input']; @@ -1823,7 +1821,7 @@ export type DepositsQueryVariables = Exact<{ }>; -export type DepositsQuery = { __typename?: 'Query', deposits: { __typename?: 'DepositConnection', pageInfo: { __typename?: 'PageInfo', hasPreviousPage: boolean, hasNextPage: boolean, startCursor?: string | null, endCursor?: string | null }, edges: Array<{ __typename?: 'DepositEdge', cursor: string, node: { __typename?: 'Deposit', depositId: string, amount: UsdCents, reference: string, customer: { __typename?: 'Customer', email: string } } }> } }; +export type DepositsQuery = { __typename?: 'Query', deposits: { __typename?: 'DepositConnection', pageInfo: { __typename?: 'PageInfo', hasPreviousPage: boolean, hasNextPage: boolean, startCursor?: string | null, endCursor?: string | null }, edges: Array<{ __typename?: 'DepositEdge', cursor: string, node: { __typename?: 'Deposit', depositId: string, amount: UsdCents, reference: string } }> } }; export type GetDisbursalDetailsQueryVariables = Exact<{ id: Scalars['UUID']['input']; @@ -1981,28 +1979,28 @@ export type GetWithdrawalDetailsQueryVariables = Exact<{ }>; -export type GetWithdrawalDetailsQuery = { __typename?: 'Query', withdrawal?: { __typename?: 'Withdrawal', customerId: string, withdrawalId: string, amount: UsdCents, status: WithdrawalStatus, reference: string, subjectCanConfirm: boolean, subjectCanCancel: boolean, customer: { __typename?: 'Customer', email: string, customerId: string, applicantId?: string | null }, approvalProcess: { __typename?: 'ApprovalProcess', approvalProcessId: string, deniedReason?: string | null, approvalProcessType: ApprovalProcessType, createdAt: any, subjectCanSubmitDecision: boolean, status: ApprovalProcessStatus, rules: { __typename?: 'CommitteeThreshold', threshold: number, committee: { __typename?: 'Committee', name: string, currentMembers: Array<{ __typename?: 'User', email: string, roles: Array }> } } | { __typename?: 'SystemApproval', autoApprove: boolean }, voters: Array<{ __typename?: 'ApprovalProcessVoter', stillEligible: boolean, didVote: boolean, didApprove: boolean, didDeny: boolean, user: { __typename?: 'User', userId: string, email: string, roles: Array } }> } } | null }; +export type GetWithdrawalDetailsQuery = { __typename?: 'Query', withdrawal?: { __typename?: 'Withdrawal', withdrawalId: string, amount: UsdCents, status: WithdrawalStatus, reference: string, approvalProcess: { __typename?: 'ApprovalProcess', approvalProcessId: string, deniedReason?: string | null, approvalProcessType: ApprovalProcessType, createdAt: any, subjectCanSubmitDecision: boolean, status: ApprovalProcessStatus, rules: { __typename?: 'CommitteeThreshold', threshold: number, committee: { __typename?: 'Committee', name: string, currentMembers: Array<{ __typename?: 'User', email: string, roles: Array }> } } | { __typename?: 'SystemApproval', autoApprove: boolean }, voters: Array<{ __typename?: 'ApprovalProcessVoter', stillEligible: boolean, didVote: boolean, didApprove: boolean, didDeny: boolean, user: { __typename?: 'User', userId: string, email: string, roles: Array } }> } } | null }; export type WithdrawalCancelMutationVariables = Exact<{ input: WithdrawalCancelInput; }>; -export type WithdrawalCancelMutation = { __typename?: 'Mutation', withdrawalCancel: { __typename?: 'WithdrawalCancelPayload', withdrawal: { __typename?: 'Withdrawal', withdrawalId: string, amount: UsdCents, customer: { __typename?: 'Customer', customerId: string, balance: { __typename?: 'CustomerBalance', checking: { __typename?: 'Checking', settled: UsdCents, pending: UsdCents } } } } } }; +export type WithdrawalCancelMutation = { __typename?: 'Mutation', withdrawalCancel: { __typename?: 'WithdrawalCancelPayload', withdrawal: { __typename?: 'Withdrawal', withdrawalId: string, amount: UsdCents } } }; export type WithdrawalConfirmMutationVariables = Exact<{ input: WithdrawalConfirmInput; }>; -export type WithdrawalConfirmMutation = { __typename?: 'Mutation', withdrawalConfirm: { __typename?: 'WithdrawalConfirmPayload', withdrawal: { __typename?: 'Withdrawal', withdrawalId: string, amount: UsdCents, reference: string, customer: { __typename?: 'Customer', customerId: string, email: string, balance: { __typename?: 'CustomerBalance', checking: { __typename?: 'Checking', settled: UsdCents, pending: UsdCents } } } } } }; +export type WithdrawalConfirmMutation = { __typename?: 'Mutation', withdrawalConfirm: { __typename?: 'WithdrawalConfirmPayload', withdrawal: { __typename?: 'Withdrawal', withdrawalId: string, amount: UsdCents, reference: string } } }; export type WithdrawalInitiateMutationVariables = Exact<{ input: WithdrawalInitiateInput; }>; -export type WithdrawalInitiateMutation = { __typename?: 'Mutation', withdrawalInitiate: { __typename?: 'WithdrawalInitiatePayload', withdrawal: { __typename?: 'Withdrawal', withdrawalId: string, amount: UsdCents, customer: { __typename?: 'Customer', customerId: string, balance: { __typename?: 'CustomerBalance', checking: { __typename?: 'Checking', settled: UsdCents, pending: UsdCents } } } } } }; +export type WithdrawalInitiateMutation = { __typename?: 'Mutation', withdrawalInitiate: { __typename?: 'WithdrawalInitiatePayload', withdrawal: { __typename?: 'Withdrawal', withdrawalId: string, amount: UsdCents } } }; export type WithdrawalsQueryVariables = Exact<{ first: Scalars['Int']['input']; @@ -2010,7 +2008,7 @@ export type WithdrawalsQueryVariables = Exact<{ }>; -export type WithdrawalsQuery = { __typename?: 'Query', withdrawals: { __typename?: 'WithdrawalConnection', pageInfo: { __typename?: 'PageInfo', hasPreviousPage: boolean, hasNextPage: boolean, startCursor?: string | null, endCursor?: string | null }, edges: Array<{ __typename?: 'WithdrawalEdge', cursor: string, node: { __typename?: 'Withdrawal', customerId: string, withdrawalId: string, amount: UsdCents, status: WithdrawalStatus, reference: string, subjectCanConfirm: boolean, subjectCanCancel: boolean, customer: { __typename?: 'Customer', customerId: string, email: string } } }> } }; +export type WithdrawalsQuery = { __typename?: 'Query', withdrawals: { __typename?: 'WithdrawalConnection', pageInfo: { __typename?: 'PageInfo', hasPreviousPage: boolean, hasNextPage: boolean, startCursor?: string | null, endCursor?: string | null }, edges: Array<{ __typename?: 'WithdrawalEdge', cursor: string, node: { __typename?: 'Withdrawal', withdrawalId: string, amount: UsdCents, status: WithdrawalStatus, reference: string } }> } }; export type AvatarQueryVariables = Exact<{ [key: string]: never; }>; @@ -2217,9 +2215,6 @@ export const AllActionsDocument = gql` __typename ... on Withdrawal { withdrawalId - customer { - email - } } ... on CreditFacility { creditFacilityId @@ -3518,8 +3513,8 @@ export const GetCustomerOverviewDocument = gql` customer(id: $id) { id customerId - balance { - checking { + depositAccount { + balance { settled pending } @@ -3559,29 +3554,24 @@ export const GetCustomerTransactionsDocument = gql` query GetCustomerTransactions($id: UUID!) { customer(id: $id) { id - deposits { - createdAt - customerId - depositId - reference - amount - } - withdrawals { - status - reference - customerId - withdrawalId - createdAt - amount - customer { - customerId - email + depositAccount { + deposits { + createdAt + depositId + reference + amount + } + withdrawals { + status + reference + withdrawalId + createdAt + amount } } transactions @client { ... on Deposit { createdAt - customerId depositId reference amount @@ -3589,14 +3579,9 @@ export const GetCustomerTransactionsDocument = gql` ... on Withdrawal { status reference - customerId withdrawalId createdAt amount - customer { - customerId - email - } } } } @@ -3720,14 +3705,12 @@ export const CustomersDocument = gql` email telegramId applicantId - balance { - checking { + depositAccount { + balance { settled pending } } - subjectCanRecordDeposit - subjectCanInitiateWithdrawal subjectCanCreateCreditFacility } cursor @@ -3815,15 +3798,6 @@ export const CreateDepositDocument = gql` deposit { depositId amount - customer { - customerId - email - balance { - checking { - settled - } - } - } } } } @@ -3869,9 +3843,6 @@ export const DepositsDocument = gql` depositId amount reference - customer { - email - } } } } @@ -4887,18 +4858,10 @@ export type UserRevokeRoleMutationOptions = Apollo.BaseMutationOptions, _relat }; }; -export const mockChecking = (overrides?: Partial, _relationshipsToOmit: Set = new Set()): Checking => { - const relationshipsToOmit: Set = new Set(_relationshipsToOmit); - relationshipsToOmit.add('Checking'); - return { - pending: overrides && overrides.hasOwnProperty('pending') ? overrides.pending! : generateMockValue.usdCents(), - settled: overrides && overrides.hasOwnProperty('settled') ? overrides.settled! : generateMockValue.usdCents(), - }; -}; - export const mockCollateral = (overrides?: Partial, _relationshipsToOmit: Set = new Set()): Collateral => { const relationshipsToOmit: Set = new Set(_relationshipsToOmit); relationshipsToOmit.add('Collateral'); @@ -661,30 +652,18 @@ export const mockCustomer = (overrides?: Partial, _relationshipsToOmit relationshipsToOmit.add('Customer'); return { applicantId: overrides && overrides.hasOwnProperty('applicantId') ? overrides.applicantId! : generateMockValue.applicantId(), - balance: overrides && overrides.hasOwnProperty('balance') ? overrides.balance! : relationshipsToOmit.has('CustomerBalance') ? {} as CustomerBalance : mockCustomerBalance({}, relationshipsToOmit), createdAt: overrides && overrides.hasOwnProperty('createdAt') ? overrides.createdAt! : generateMockValue.timestamp(), creditFacilities: overrides && overrides.hasOwnProperty('creditFacilities') ? overrides.creditFacilities! : [relationshipsToOmit.has('CreditFacility') ? {} as CreditFacility : mockCreditFacility({}, relationshipsToOmit)], customerId: overrides && overrides.hasOwnProperty('customerId') ? overrides.customerId! : generateMockValue.uuid(), - deposits: overrides && overrides.hasOwnProperty('deposits') ? overrides.deposits! : [relationshipsToOmit.has('Deposit') ? {} as Deposit : mockDeposit({}, relationshipsToOmit)], + depositAccount: overrides && overrides.hasOwnProperty('depositAccount') ? overrides.depositAccount! : relationshipsToOmit.has('DepositAccount') ? {} as DepositAccount : mockDepositAccount({}, relationshipsToOmit), documents: overrides && overrides.hasOwnProperty('documents') ? overrides.documents! : [relationshipsToOmit.has('Document') ? {} as Document : mockDocument({}, relationshipsToOmit)], email: overrides && overrides.hasOwnProperty('email') ? overrides.email! : generateMockValue.email(), id: overrides && overrides.hasOwnProperty('id') ? overrides.id! : faker.string.uuid(), level: overrides && overrides.hasOwnProperty('level') ? overrides.level! : mockEnums.kycLevel(), status: overrides && overrides.hasOwnProperty('status') ? overrides.status! : mockEnums.accountStatus(), subjectCanCreateCreditFacility: overrides && overrides.hasOwnProperty('subjectCanCreateCreditFacility') ? overrides.subjectCanCreateCreditFacility! : faker.datatype.boolean(), - subjectCanInitiateWithdrawal: overrides && overrides.hasOwnProperty('subjectCanInitiateWithdrawal') ? overrides.subjectCanInitiateWithdrawal! : faker.datatype.boolean(), - subjectCanRecordDeposit: overrides && overrides.hasOwnProperty('subjectCanRecordDeposit') ? overrides.subjectCanRecordDeposit! : faker.datatype.boolean(), telegramId: overrides && overrides.hasOwnProperty('telegramId') ? overrides.telegramId! : generateMockValue.telegramId(), transactions: overrides && overrides.hasOwnProperty('transactions') ? overrides.transactions! : [relationshipsToOmit.has('Deposit') ? {} as Deposit : mockDeposit({}, relationshipsToOmit)], - withdrawals: overrides && overrides.hasOwnProperty('withdrawals') ? overrides.withdrawals! : [relationshipsToOmit.has('Withdrawal') ? {} as Withdrawal : mockWithdrawal({}, relationshipsToOmit)], - }; -}; - -export const mockCustomerBalance = (overrides?: Partial, _relationshipsToOmit: Set = new Set()): CustomerBalance => { - const relationshipsToOmit: Set = new Set(_relationshipsToOmit); - relationshipsToOmit.add('CustomerBalance'); - return { - checking: overrides && overrides.hasOwnProperty('checking') ? overrides.checking! : relationshipsToOmit.has('Checking') ? {} as Checking : mockChecking({}, relationshipsToOmit), }; }; @@ -776,14 +755,37 @@ export const mockDeposit = (overrides?: Partial, _relationshipsToOmit: return { amount: overrides && overrides.hasOwnProperty('amount') ? overrides.amount! : generateMockValue.usdCents(), createdAt: overrides && overrides.hasOwnProperty('createdAt') ? overrides.createdAt! : generateMockValue.timestamp(), - customer: overrides && overrides.hasOwnProperty('customer') ? overrides.customer! : relationshipsToOmit.has('Customer') ? {} as Customer : mockCustomer({}, relationshipsToOmit), - customerId: overrides && overrides.hasOwnProperty('customerId') ? overrides.customerId! : generateMockValue.uuid(), + depositAccountId: overrides && overrides.hasOwnProperty('depositAccountId') ? overrides.depositAccountId! : generateMockValue.uuid(), depositId: overrides && overrides.hasOwnProperty('depositId') ? overrides.depositId! : generateMockValue.uuid(), id: overrides && overrides.hasOwnProperty('id') ? overrides.id! : faker.string.uuid(), reference: overrides && overrides.hasOwnProperty('reference') ? overrides.reference! : generateMockValue.reference(), }; }; +export const mockDepositAccount = (overrides?: Partial, _relationshipsToOmit: Set = new Set()): DepositAccount => { + const relationshipsToOmit: Set = new Set(_relationshipsToOmit); + relationshipsToOmit.add('DepositAccount'); + return { + balance: overrides && overrides.hasOwnProperty('balance') ? overrides.balance! : relationshipsToOmit.has('DepositAccountBalance') ? {} as DepositAccountBalance : mockDepositAccountBalance({}, relationshipsToOmit), + createdAt: overrides && overrides.hasOwnProperty('createdAt') ? overrides.createdAt! : generateMockValue.timestamp(), + customer: overrides && overrides.hasOwnProperty('customer') ? overrides.customer! : relationshipsToOmit.has('Customer') ? {} as Customer : mockCustomer({}, relationshipsToOmit), + customerId: overrides && overrides.hasOwnProperty('customerId') ? overrides.customerId! : generateMockValue.uuid(), + depositAccountId: overrides && overrides.hasOwnProperty('depositAccountId') ? overrides.depositAccountId! : generateMockValue.uuid(), + deposits: overrides && overrides.hasOwnProperty('deposits') ? overrides.deposits! : [relationshipsToOmit.has('Deposit') ? {} as Deposit : mockDeposit({}, relationshipsToOmit)], + id: overrides && overrides.hasOwnProperty('id') ? overrides.id! : faker.string.uuid(), + withdrawals: overrides && overrides.hasOwnProperty('withdrawals') ? overrides.withdrawals! : [relationshipsToOmit.has('Withdrawal') ? {} as Withdrawal : mockWithdrawal({}, relationshipsToOmit)], + }; +}; + +export const mockDepositAccountBalance = (overrides?: Partial, _relationshipsToOmit: Set = new Set()): DepositAccountBalance => { + const relationshipsToOmit: Set = new Set(_relationshipsToOmit); + relationshipsToOmit.add('DepositAccountBalance'); + return { + pending: overrides && overrides.hasOwnProperty('pending') ? overrides.pending! : generateMockValue.usdCents(), + settled: overrides && overrides.hasOwnProperty('settled') ? overrides.settled! : generateMockValue.usdCents(), + }; +}; + export const mockDepositConnection = (overrides?: Partial, _relationshipsToOmit: Set = new Set()): DepositConnection => { const relationshipsToOmit: Set = new Set(_relationshipsToOmit); relationshipsToOmit.add('DepositConnection'); @@ -808,7 +810,7 @@ export const mockDepositRecordInput = (overrides?: Partial, relationshipsToOmit.add('DepositRecordInput'); return { amount: overrides && overrides.hasOwnProperty('amount') ? overrides.amount! : generateMockValue.usdCents(), - customerId: overrides && overrides.hasOwnProperty('customerId') ? overrides.customerId! : generateMockValue.uuid(), + depositAccountId: overrides && overrides.hasOwnProperty('depositAccountId') ? overrides.depositAccountId! : generateMockValue.uuid(), reference: overrides && overrides.hasOwnProperty('reference') ? overrides.reference! : generateMockValue.reference(), }; }; @@ -1493,13 +1495,9 @@ export const mockWithdrawal = (overrides?: Partial, _relationshipsTo approvalProcess: overrides && overrides.hasOwnProperty('approvalProcess') ? overrides.approvalProcess! : relationshipsToOmit.has('ApprovalProcess') ? {} as ApprovalProcess : mockApprovalProcess({}, relationshipsToOmit), approvalProcessId: overrides && overrides.hasOwnProperty('approvalProcessId') ? overrides.approvalProcessId! : generateMockValue.uuid(), createdAt: overrides && overrides.hasOwnProperty('createdAt') ? overrides.createdAt! : generateMockValue.timestamp(), - customer: overrides && overrides.hasOwnProperty('customer') ? overrides.customer! : relationshipsToOmit.has('Customer') ? {} as Customer : mockCustomer({}, relationshipsToOmit), - customerId: overrides && overrides.hasOwnProperty('customerId') ? overrides.customerId! : generateMockValue.uuid(), id: overrides && overrides.hasOwnProperty('id') ? overrides.id! : faker.string.uuid(), reference: overrides && overrides.hasOwnProperty('reference') ? overrides.reference! : generateMockValue.reference(), status: overrides && overrides.hasOwnProperty('status') ? overrides.status! : mockEnums.withdrawalStatus(), - subjectCanCancel: overrides && overrides.hasOwnProperty('subjectCanCancel') ? overrides.subjectCanCancel! : faker.datatype.boolean(), - subjectCanConfirm: overrides && overrides.hasOwnProperty('subjectCanConfirm') ? overrides.subjectCanConfirm! : faker.datatype.boolean(), withdrawalId: overrides && overrides.hasOwnProperty('withdrawalId') ? overrides.withdrawalId! : generateMockValue.uuid(), }; }; @@ -1560,7 +1558,7 @@ export const mockWithdrawalInitiateInput = (overrides?: Partial