@accounter/server 0.0.8-alpha-20251109135059-0b69d374535c156a95ca85b775e3658e3b3856e7 → 0.0.8-alpha-20251109135308-a84f8e3eb2a8a6f57c2ecf91b0965dfafbc40bf8
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/CHANGELOG.md +5 -5
- package/dist/green-invoice-graphql/src/mesh-artifacts/index.d.ts +1 -1
- package/dist/server/src/modules/financial-accounts/__generated__/financial-accounts.types.d.ts +72 -0
- package/dist/server/src/modules/financial-accounts/__generated__/types.d.ts +13 -13
- package/dist/server/src/modules/financial-accounts/index.js +3 -6
- package/dist/server/src/modules/financial-accounts/index.js.map +1 -1
- package/dist/server/src/modules/financial-accounts/providers/financial-accounts.provider.js +4 -4
- package/dist/server/src/modules/financial-accounts/resolvers/financial-accounts.resolver.js +8 -0
- package/dist/server/src/modules/financial-accounts/resolvers/financial-accounts.resolver.js.map +1 -1
- package/dist/server/src/modules/financial-accounts/typeDefs/financial-accounts.graphql.js +11 -0
- package/dist/server/src/modules/financial-accounts/typeDefs/financial-accounts.graphql.js.map +1 -1
- package/dist/server/src/modules/financial-accounts/types.d.ts +0 -1
- package/dist/server/src/modules/financial-accounts/types.js +0 -1
- package/dist/server/src/modules/financial-accounts/types.js.map +1 -1
- package/dist/server/src/modules/green-invoice/helpers/issue-document.helper.js +2 -9
- package/dist/server/src/modules/green-invoice/helpers/issue-document.helper.js.map +1 -1
- package/package.json +3 -3
- package/src/modules/financial-accounts/__generated__/financial-accounts.types.ts +72 -0
- package/src/modules/financial-accounts/__generated__/types.ts +13 -13
- package/src/modules/financial-accounts/index.ts +3 -6
- package/src/modules/financial-accounts/providers/financial-accounts.provider.ts +4 -4
- package/src/modules/financial-accounts/resolvers/financial-accounts.resolver.ts +8 -0
- package/src/modules/financial-accounts/typeDefs/financial-accounts.graphql.ts +11 -0
- package/src/modules/financial-accounts/types.ts +0 -1
- package/src/modules/green-invoice/helpers/issue-document.helper.ts +2 -11
- package/dist/server/src/modules/financial-accounts/__generated__/financial-bank-accounts.types.d.ts +0 -155
- package/dist/server/src/modules/financial-accounts/__generated__/financial-bank-accounts.types.js +0 -3
- package/dist/server/src/modules/financial-accounts/__generated__/financial-bank-accounts.types.js.map +0 -1
- package/dist/server/src/modules/financial-accounts/providers/financial-bank-accounts.provider.d.ts +0 -24
- package/dist/server/src/modules/financial-accounts/providers/financial-bank-accounts.provider.js +0 -190
- package/dist/server/src/modules/financial-accounts/providers/financial-bank-accounts.provider.js.map +0 -1
- package/dist/server/src/modules/financial-accounts/resolvers/financial-bank-accounts.resolver.d.ts +0 -2
- package/dist/server/src/modules/financial-accounts/resolvers/financial-bank-accounts.resolver.js +0 -37
- package/dist/server/src/modules/financial-accounts/resolvers/financial-bank-accounts.resolver.js.map +0 -1
- package/dist/server/src/modules/financial-accounts/typeDefs/financial-bank-accounts.graphql.d.ts +0 -2
- package/dist/server/src/modules/financial-accounts/typeDefs/financial-bank-accounts.graphql.js +0 -14
- package/dist/server/src/modules/financial-accounts/typeDefs/financial-bank-accounts.graphql.js.map +0 -1
- package/src/modules/financial-accounts/__generated__/financial-bank-accounts.types.ts +0 -171
- package/src/modules/financial-accounts/providers/financial-bank-accounts.provider.ts +0 -213
- package/src/modules/financial-accounts/resolvers/financial-bank-accounts.resolver.ts +0 -44
- package/src/modules/financial-accounts/typeDefs/financial-bank-accounts.graphql.ts +0 -14
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
/** Types generated for queries found in "src/modules/financial-accounts/providers/financial-bank-accounts.provider.ts" */
|
|
2
|
-
|
|
3
|
-
/** 'GetFinancialBankAccountsByIds' parameters type */
|
|
4
|
-
export interface IGetFinancialBankAccountsByIdsParams {
|
|
5
|
-
bankAccountIds: readonly (string | null | void)[];
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
/** 'GetFinancialBankAccountsByIds' return type */
|
|
9
|
-
export interface IGetFinancialBankAccountsByIdsResult {
|
|
10
|
-
account_agreement_opening_date: number | null;
|
|
11
|
-
account_closing_reason_code: number | null;
|
|
12
|
-
account_deal_date: number | null;
|
|
13
|
-
account_update_date: number | null;
|
|
14
|
-
bank_number: number;
|
|
15
|
-
branch_number: number;
|
|
16
|
-
branch_type_code: number | null;
|
|
17
|
-
extended_bank_number: number | null;
|
|
18
|
-
id: string;
|
|
19
|
-
kod_harshaat_peilut: number | null;
|
|
20
|
-
meteg_doar_net: number | null;
|
|
21
|
-
mymail_entitlement_switch: number | null;
|
|
22
|
-
party_account_involvement_code: number | null;
|
|
23
|
-
party_preferred_indication: number | null;
|
|
24
|
-
product_label: string | null;
|
|
25
|
-
service_authorization_desc: string | null;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/** 'GetFinancialBankAccountsByIds' query type */
|
|
29
|
-
export interface IGetFinancialBankAccountsByIdsQuery {
|
|
30
|
-
params: IGetFinancialBankAccountsByIdsParams;
|
|
31
|
-
result: IGetFinancialBankAccountsByIdsResult;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/** 'GetAllFinancialBankAccounts' parameters type */
|
|
35
|
-
export type IGetAllFinancialBankAccountsParams = void;
|
|
36
|
-
|
|
37
|
-
/** 'GetAllFinancialBankAccounts' return type */
|
|
38
|
-
export interface IGetAllFinancialBankAccountsResult {
|
|
39
|
-
account_agreement_opening_date: number | null;
|
|
40
|
-
account_closing_reason_code: number | null;
|
|
41
|
-
account_deal_date: number | null;
|
|
42
|
-
account_update_date: number | null;
|
|
43
|
-
bank_number: number;
|
|
44
|
-
branch_number: number;
|
|
45
|
-
branch_type_code: number | null;
|
|
46
|
-
extended_bank_number: number | null;
|
|
47
|
-
id: string;
|
|
48
|
-
kod_harshaat_peilut: number | null;
|
|
49
|
-
meteg_doar_net: number | null;
|
|
50
|
-
mymail_entitlement_switch: number | null;
|
|
51
|
-
party_account_involvement_code: number | null;
|
|
52
|
-
party_preferred_indication: number | null;
|
|
53
|
-
product_label: string | null;
|
|
54
|
-
service_authorization_desc: string | null;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/** 'GetAllFinancialBankAccounts' query type */
|
|
58
|
-
export interface IGetAllFinancialBankAccountsQuery {
|
|
59
|
-
params: IGetAllFinancialBankAccountsParams;
|
|
60
|
-
result: IGetAllFinancialBankAccountsResult;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/** 'UpdateBankAccount' parameters type */
|
|
64
|
-
export interface IUpdateBankAccountParams {
|
|
65
|
-
accountAgreementOpeningDate?: number | null | void;
|
|
66
|
-
accountClosingReasonCode?: number | null | void;
|
|
67
|
-
accountDealDate?: number | null | void;
|
|
68
|
-
accountUpdateDate?: number | null | void;
|
|
69
|
-
bankAccountId?: string | null | void;
|
|
70
|
-
bankNumber?: number | null | void;
|
|
71
|
-
branchNumber?: number | null | void;
|
|
72
|
-
branchTypeCode?: number | null | void;
|
|
73
|
-
extendedBankNumber?: number | null | void;
|
|
74
|
-
kodHarshaatPeilut?: number | null | void;
|
|
75
|
-
metegDoarNet?: number | null | void;
|
|
76
|
-
mymailEntitlementSwitch?: number | null | void;
|
|
77
|
-
partyAccountInvolvementCode?: number | null | void;
|
|
78
|
-
partyPreferredIndication?: number | null | void;
|
|
79
|
-
productLabel?: string | null | void;
|
|
80
|
-
serviceAuthorizationDesc?: string | null | void;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/** 'UpdateBankAccount' return type */
|
|
84
|
-
export interface IUpdateBankAccountResult {
|
|
85
|
-
account_agreement_opening_date: number | null;
|
|
86
|
-
account_closing_reason_code: number | null;
|
|
87
|
-
account_deal_date: number | null;
|
|
88
|
-
account_update_date: number | null;
|
|
89
|
-
bank_number: number;
|
|
90
|
-
branch_number: number;
|
|
91
|
-
branch_type_code: number | null;
|
|
92
|
-
extended_bank_number: number | null;
|
|
93
|
-
id: string;
|
|
94
|
-
kod_harshaat_peilut: number | null;
|
|
95
|
-
meteg_doar_net: number | null;
|
|
96
|
-
mymail_entitlement_switch: number | null;
|
|
97
|
-
party_account_involvement_code: number | null;
|
|
98
|
-
party_preferred_indication: number | null;
|
|
99
|
-
product_label: string | null;
|
|
100
|
-
service_authorization_desc: string | null;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/** 'UpdateBankAccount' query type */
|
|
104
|
-
export interface IUpdateBankAccountQuery {
|
|
105
|
-
params: IUpdateBankAccountParams;
|
|
106
|
-
result: IUpdateBankAccountResult;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/** 'InsertBankAccounts' parameters type */
|
|
110
|
-
export interface IInsertBankAccountsParams {
|
|
111
|
-
bankAccounts: readonly ({
|
|
112
|
-
bankNumber: number | null | void,
|
|
113
|
-
branchNumber: number | null | void,
|
|
114
|
-
extendedBankNumber: number | null | void,
|
|
115
|
-
partyPreferredIndication: number | null | void,
|
|
116
|
-
partyAccountInvolvementCode: number | null | void,
|
|
117
|
-
accountDealDate: number | null | void,
|
|
118
|
-
accountUpdateDate: number | null | void,
|
|
119
|
-
metegDoarNet: number | null | void,
|
|
120
|
-
kodHarshaatPeilut: number | null | void,
|
|
121
|
-
accountClosingReasonCode: number | null | void,
|
|
122
|
-
accountAgreementOpeningDate: number | null | void,
|
|
123
|
-
serviceAuthorizationDesc: string | null | void,
|
|
124
|
-
branchTypeCode: number | null | void,
|
|
125
|
-
mymailEntitlementSwitch: number | null | void,
|
|
126
|
-
productLabel: string | null | void
|
|
127
|
-
})[];
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/** 'InsertBankAccounts' return type */
|
|
131
|
-
export interface IInsertBankAccountsResult {
|
|
132
|
-
account_agreement_opening_date: number | null;
|
|
133
|
-
account_closing_reason_code: number | null;
|
|
134
|
-
account_deal_date: number | null;
|
|
135
|
-
account_update_date: number | null;
|
|
136
|
-
bank_number: number;
|
|
137
|
-
branch_number: number;
|
|
138
|
-
branch_type_code: number | null;
|
|
139
|
-
extended_bank_number: number | null;
|
|
140
|
-
id: string;
|
|
141
|
-
kod_harshaat_peilut: number | null;
|
|
142
|
-
meteg_doar_net: number | null;
|
|
143
|
-
mymail_entitlement_switch: number | null;
|
|
144
|
-
party_account_involvement_code: number | null;
|
|
145
|
-
party_preferred_indication: number | null;
|
|
146
|
-
product_label: string | null;
|
|
147
|
-
service_authorization_desc: string | null;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
/** 'InsertBankAccounts' query type */
|
|
151
|
-
export interface IInsertBankAccountsQuery {
|
|
152
|
-
params: IInsertBankAccountsParams;
|
|
153
|
-
result: IInsertBankAccountsResult;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
/** 'DeleteBankAccount' parameters type */
|
|
157
|
-
export interface IDeleteBankAccountParams {
|
|
158
|
-
bankAccountId?: string | null | void;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
/** 'DeleteBankAccount' return type */
|
|
162
|
-
export interface IDeleteBankAccountResult {
|
|
163
|
-
id: string;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/** 'DeleteBankAccount' query type */
|
|
167
|
-
export interface IDeleteBankAccountQuery {
|
|
168
|
-
params: IDeleteBankAccountParams;
|
|
169
|
-
result: IDeleteBankAccountResult;
|
|
170
|
-
}
|
|
171
|
-
|
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
import DataLoader from 'dataloader';
|
|
2
|
-
import { Injectable, Scope } from 'graphql-modules';
|
|
3
|
-
import { DBProvider } from '@modules/app-providers/db.provider.js';
|
|
4
|
-
import { sql } from '@pgtyped/runtime';
|
|
5
|
-
import { getCacheInstance } from '@shared/helpers';
|
|
6
|
-
import type {
|
|
7
|
-
IDeleteBankAccountParams,
|
|
8
|
-
IDeleteBankAccountQuery,
|
|
9
|
-
IGetAllFinancialBankAccountsQuery,
|
|
10
|
-
IGetAllFinancialBankAccountsResult,
|
|
11
|
-
IGetFinancialBankAccountsByIdsQuery,
|
|
12
|
-
IInsertBankAccountsParams,
|
|
13
|
-
IInsertBankAccountsQuery,
|
|
14
|
-
IUpdateBankAccountParams,
|
|
15
|
-
IUpdateBankAccountQuery,
|
|
16
|
-
} from '../types.js';
|
|
17
|
-
|
|
18
|
-
const getFinancialBankAccountsByIds = sql<IGetFinancialBankAccountsByIdsQuery>`
|
|
19
|
-
SELECT *
|
|
20
|
-
FROM accounter_schema.financial_bank_accounts
|
|
21
|
-
WHERE id IN $$bankAccountIds;`;
|
|
22
|
-
|
|
23
|
-
const getAllFinancialBankAccounts = sql<IGetAllFinancialBankAccountsQuery>`
|
|
24
|
-
SELECT *
|
|
25
|
-
FROM accounter_schema.financial_bank_accounts;`;
|
|
26
|
-
|
|
27
|
-
const updateBankAccount = sql<IUpdateBankAccountQuery>`
|
|
28
|
-
UPDATE accounter_schema.financial_bank_accounts
|
|
29
|
-
SET
|
|
30
|
-
bank_number =COALESCE(
|
|
31
|
-
$bankNumber,
|
|
32
|
-
bank_number
|
|
33
|
-
),
|
|
34
|
-
branch_number =COALESCE(
|
|
35
|
-
$branchNumber,
|
|
36
|
-
branch_number
|
|
37
|
-
),
|
|
38
|
-
extended_bank_number =COALESCE(
|
|
39
|
-
$extendedBankNumber,
|
|
40
|
-
extended_bank_number
|
|
41
|
-
),
|
|
42
|
-
party_preferred_indication =COALESCE(
|
|
43
|
-
$partyPreferredIndication,
|
|
44
|
-
party_preferred_indication
|
|
45
|
-
),
|
|
46
|
-
party_account_involvement_code =COALESCE(
|
|
47
|
-
$partyAccountInvolvementCode,
|
|
48
|
-
party_account_involvement_code
|
|
49
|
-
),
|
|
50
|
-
account_deal_date =COALESCE(
|
|
51
|
-
$accountDealDate,
|
|
52
|
-
account_deal_date
|
|
53
|
-
),
|
|
54
|
-
account_update_date =COALESCE(
|
|
55
|
-
$accountUpdateDate,
|
|
56
|
-
account_update_date
|
|
57
|
-
),
|
|
58
|
-
meteg_doar_net =COALESCE(
|
|
59
|
-
$metegDoarNet,
|
|
60
|
-
meteg_doar_net
|
|
61
|
-
),
|
|
62
|
-
kod_harshaat_peilut =COALESCE(
|
|
63
|
-
$kodHarshaatPeilut,
|
|
64
|
-
kod_harshaat_peilut
|
|
65
|
-
),
|
|
66
|
-
account_closing_reason_code =COALESCE(
|
|
67
|
-
$accountClosingReasonCode,
|
|
68
|
-
account_closing_reason_code
|
|
69
|
-
),
|
|
70
|
-
account_agreement_opening_date =COALESCE(
|
|
71
|
-
$accountAgreementOpeningDate,
|
|
72
|
-
account_agreement_opening_date
|
|
73
|
-
),
|
|
74
|
-
service_authorization_desc =COALESCE(
|
|
75
|
-
$serviceAuthorizationDesc,
|
|
76
|
-
service_authorization_desc
|
|
77
|
-
),
|
|
78
|
-
branch_type_code =COALESCE(
|
|
79
|
-
$branchTypeCode,
|
|
80
|
-
branch_type_code
|
|
81
|
-
),
|
|
82
|
-
mymail_entitlement_switch =COALESCE(
|
|
83
|
-
$mymailEntitlementSwitch,
|
|
84
|
-
mymail_entitlement_switch
|
|
85
|
-
),
|
|
86
|
-
product_label =COALESCE(
|
|
87
|
-
$productLabel,
|
|
88
|
-
product_label
|
|
89
|
-
)
|
|
90
|
-
WHERE
|
|
91
|
-
id = $bankAccountId
|
|
92
|
-
RETURNING *;
|
|
93
|
-
`;
|
|
94
|
-
|
|
95
|
-
const insertBankAccounts = sql<IInsertBankAccountsQuery>`
|
|
96
|
-
INSERT INTO accounter_schema.financial_bank_accounts (
|
|
97
|
-
bank_number,
|
|
98
|
-
branch_number,
|
|
99
|
-
extended_bank_number,
|
|
100
|
-
party_preferred_indication,
|
|
101
|
-
party_account_involvement_code,
|
|
102
|
-
account_deal_date,
|
|
103
|
-
account_update_date,
|
|
104
|
-
meteg_doar_net,
|
|
105
|
-
kod_harshaat_peilut,
|
|
106
|
-
account_closing_reason_code,
|
|
107
|
-
account_agreement_opening_date,
|
|
108
|
-
service_authorization_desc,
|
|
109
|
-
branch_type_code,
|
|
110
|
-
mymail_entitlement_switch,
|
|
111
|
-
product_label
|
|
112
|
-
)
|
|
113
|
-
VALUES $$bankAccounts(
|
|
114
|
-
bankNumber,
|
|
115
|
-
branchNumber,
|
|
116
|
-
extendedBankNumber,
|
|
117
|
-
partyPreferredIndication,
|
|
118
|
-
partyAccountInvolvementCode,
|
|
119
|
-
accountDealDate,
|
|
120
|
-
accountUpdateDate,
|
|
121
|
-
metegDoarNet,
|
|
122
|
-
kodHarshaatPeilut,
|
|
123
|
-
accountClosingReasonCode,
|
|
124
|
-
accountAgreementOpeningDate,
|
|
125
|
-
serviceAuthorizationDesc,
|
|
126
|
-
branchTypeCode,
|
|
127
|
-
mymailEntitlementSwitch,
|
|
128
|
-
productLabel
|
|
129
|
-
)
|
|
130
|
-
RETURNING *;`;
|
|
131
|
-
|
|
132
|
-
const deleteBankAccount = sql<IDeleteBankAccountQuery>`
|
|
133
|
-
DELETE FROM accounter_schema.financial_bank_accounts
|
|
134
|
-
WHERE id = $bankAccountId
|
|
135
|
-
RETURNING id;
|
|
136
|
-
`;
|
|
137
|
-
|
|
138
|
-
@Injectable({
|
|
139
|
-
scope: Scope.Singleton,
|
|
140
|
-
global: true,
|
|
141
|
-
})
|
|
142
|
-
export class FinancialBankAccountsProvider {
|
|
143
|
-
cache = getCacheInstance({
|
|
144
|
-
stdTTL: 60 * 5,
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
constructor(private dbProvider: DBProvider) {}
|
|
148
|
-
|
|
149
|
-
private async batchFinancialBankAccountsByIds(bankAccountIds: readonly string[]) {
|
|
150
|
-
const accounts = await getFinancialBankAccountsByIds.run(
|
|
151
|
-
{
|
|
152
|
-
bankAccountIds,
|
|
153
|
-
},
|
|
154
|
-
this.dbProvider,
|
|
155
|
-
);
|
|
156
|
-
return bankAccountIds.map(id => accounts.find(account => account.id === id));
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
public getFinancialBankAccountByIdLoader = new DataLoader(
|
|
160
|
-
(bankAccountIds: readonly string[]) => this.batchFinancialBankAccountsByIds(bankAccountIds),
|
|
161
|
-
{
|
|
162
|
-
cacheKeyFn: key => `bank-account-id-${key}`,
|
|
163
|
-
cacheMap: this.cache,
|
|
164
|
-
},
|
|
165
|
-
);
|
|
166
|
-
|
|
167
|
-
public getAllFinancialBankAccounts() {
|
|
168
|
-
const cached = this.cache.get<IGetAllFinancialBankAccountsResult[]>('all-bank-accounts');
|
|
169
|
-
if (cached) {
|
|
170
|
-
return Promise.resolve(cached);
|
|
171
|
-
}
|
|
172
|
-
return getAllFinancialBankAccounts.run(undefined, this.dbProvider).then(res => {
|
|
173
|
-
this.cache.set('all-bank-accounts', res);
|
|
174
|
-
res.map(account => {
|
|
175
|
-
this.cache.set(`bank-account-id-${account.id}`, account);
|
|
176
|
-
});
|
|
177
|
-
return res;
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
public async updateBankAccount(params: IUpdateBankAccountParams) {
|
|
182
|
-
if (params.bankAccountId) {
|
|
183
|
-
this.invalidateById(params.bankAccountId);
|
|
184
|
-
const bankAccount = await this.getFinancialBankAccountByIdLoader.load(params.bankAccountId);
|
|
185
|
-
if (bankAccount?.id) {
|
|
186
|
-
this.cache.set(`bank-account-id-${bankAccount?.id}`, bankAccount);
|
|
187
|
-
}
|
|
188
|
-
return bankAccount;
|
|
189
|
-
}
|
|
190
|
-
return updateBankAccount.run(params, this.dbProvider);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
public async deleteBankAccount(params: IDeleteBankAccountParams) {
|
|
194
|
-
if (params.bankAccountId) {
|
|
195
|
-
this.invalidateById(params.bankAccountId);
|
|
196
|
-
}
|
|
197
|
-
return deleteBankAccount.run(params, this.dbProvider);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
public async insertBankAccounts(params: IInsertBankAccountsParams) {
|
|
201
|
-
this.cache.delete('all-bank-accounts');
|
|
202
|
-
return insertBankAccounts.run(params, this.dbProvider);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
public invalidateById(bankAccountId: string) {
|
|
206
|
-
this.cache.delete(`bank-account-id-${bankAccountId}`);
|
|
207
|
-
this.cache.delete('all-bank-accounts');
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
public clearCache() {
|
|
211
|
-
this.cache.clear();
|
|
212
|
-
}
|
|
213
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { GraphQLError } from 'graphql';
|
|
2
|
-
import { FinancialBankAccountsProvider } from '../providers/financial-bank-accounts.provider.js';
|
|
3
|
-
import type { FinancialAccountsModule, IGetFinancialBankAccountsByIdsResult } from '../types.js';
|
|
4
|
-
import { commonFinancialAccountFields } from './common.js';
|
|
5
|
-
|
|
6
|
-
function validateBankAccount(
|
|
7
|
-
bankAccount: IGetFinancialBankAccountsByIdsResult | undefined,
|
|
8
|
-
): IGetFinancialBankAccountsByIdsResult {
|
|
9
|
-
if (!bankAccount) {
|
|
10
|
-
throw new GraphQLError('Bank account not found');
|
|
11
|
-
}
|
|
12
|
-
return bankAccount;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const financialBankAccountsResolvers: FinancialAccountsModule.Resolvers = {
|
|
16
|
-
Query: {
|
|
17
|
-
// allFinancialAccounts: async (_, __, { injector }) => {
|
|
18
|
-
// return injector.get(FinancialAccountsProvider).getAllFinancialAccounts();
|
|
19
|
-
// },
|
|
20
|
-
},
|
|
21
|
-
BankFinancialAccount: {
|
|
22
|
-
__isTypeOf: DbAccount => DbAccount.type === 'BANK_ACCOUNT',
|
|
23
|
-
...commonFinancialAccountFields,
|
|
24
|
-
accountNumber: DbAccount => DbAccount.account_number,
|
|
25
|
-
bankNumber: async (DbAccount, _, { injector }) =>
|
|
26
|
-
injector
|
|
27
|
-
.get(FinancialBankAccountsProvider)
|
|
28
|
-
.getFinancialBankAccountByIdLoader.load(DbAccount.id)
|
|
29
|
-
.then(validateBankAccount)
|
|
30
|
-
.then(bankAccount => bankAccount.bank_number.toString()),
|
|
31
|
-
branchNumber: async (DbAccount, _, { injector }) =>
|
|
32
|
-
injector
|
|
33
|
-
.get(FinancialBankAccountsProvider)
|
|
34
|
-
.getFinancialBankAccountByIdLoader.load(DbAccount.id)
|
|
35
|
-
.then(validateBankAccount)
|
|
36
|
-
.then(bankAccount => bankAccount.branch_number.toString()),
|
|
37
|
-
name: async (DbAccount, _, { injector }) =>
|
|
38
|
-
injector
|
|
39
|
-
.get(FinancialBankAccountsProvider)
|
|
40
|
-
.getFinancialBankAccountByIdLoader.load(DbAccount.id)
|
|
41
|
-
.then(validateBankAccount)
|
|
42
|
-
.then(bankAccount => `${bankAccount.bank_number}-${DbAccount.account_number}`),
|
|
43
|
-
},
|
|
44
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { gql } from 'graphql-modules';
|
|
2
|
-
|
|
3
|
-
export default gql`
|
|
4
|
-
" represent a single bank account"
|
|
5
|
-
type BankFinancialAccount implements FinancialAccount {
|
|
6
|
-
id: UUID!
|
|
7
|
-
name: String!
|
|
8
|
-
type: String!
|
|
9
|
-
" the external identifier of the bank account "
|
|
10
|
-
accountNumber: String!
|
|
11
|
-
bankNumber: String!
|
|
12
|
-
branchNumber: String!
|
|
13
|
-
}
|
|
14
|
-
`;
|