@accounter/server 0.0.8-alpha-20251021150553-5fe662174014d6173ebcea8412cf0fa294abbed2 → 0.0.8-alpha-20251021163440-2ab1a9ffaec95fd99fac5495c3a392b97429ce77
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 +37 -4
- package/dist/server/src/__generated__/types.d.ts +166 -4
- package/dist/server/src/__generated__/types.js.map +1 -1
- package/dist/server/src/modules/app-providers/green-invoice-client.d.ts +1 -1
- package/dist/server/src/modules/charges/helpers/validate.helper.js +2 -4
- package/dist/server/src/modules/charges/helpers/validate.helper.js.map +1 -1
- package/dist/server/src/modules/contracts/__generated__/contracts.types.d.ts +145 -0
- package/dist/server/src/modules/contracts/__generated__/types.d.ts +20 -3
- package/dist/server/src/modules/contracts/__generated__/types.js +1 -0
- package/dist/server/src/modules/contracts/__generated__/types.js.map +1 -1
- package/dist/server/src/modules/contracts/providers/contracts.provider.d.ts +10 -1
- package/dist/server/src/modules/contracts/providers/contracts.provider.js +141 -0
- package/dist/server/src/modules/contracts/providers/contracts.provider.js.map +1 -1
- package/dist/server/src/modules/contracts/resolvers/contracts.resolver.js +70 -1
- package/dist/server/src/modules/contracts/resolvers/contracts.resolver.js.map +1 -1
- package/dist/server/src/modules/contracts/typeDefs/contracts.graphql.js +40 -1
- package/dist/server/src/modules/contracts/typeDefs/contracts.graphql.js.map +1 -1
- package/dist/server/src/modules/documents/__generated__/documents.types.d.ts +32 -0
- package/dist/server/src/modules/documents/__generated__/types.d.ts +2 -1
- package/dist/server/src/modules/documents/__generated__/types.js.map +1 -1
- package/dist/server/src/modules/documents/providers/documents.provider.d.ts +2 -0
- package/dist/server/src/modules/documents/providers/documents.provider.js +27 -1
- package/dist/server/src/modules/documents/providers/documents.provider.js.map +1 -1
- package/dist/server/src/modules/documents/resolvers/documents.resolver.js +10 -0
- package/dist/server/src/modules/documents/resolvers/documents.resolver.js.map +1 -1
- package/dist/server/src/modules/documents/typeDefs/documents.graphql.js +1 -0
- package/dist/server/src/modules/documents/typeDefs/documents.graphql.js.map +1 -1
- package/dist/server/src/modules/financial-entities/__generated__/businesses.types.d.ts +7 -2
- package/dist/server/src/modules/financial-entities/__generated__/clients.types.d.ts +2 -0
- package/dist/server/src/modules/financial-entities/__generated__/financial-entities.types.d.ts +6 -0
- package/dist/server/src/modules/financial-entities/__generated__/tax-categories.types.d.ts +2 -0
- package/dist/server/src/modules/financial-entities/__generated__/types.d.ts +32 -11
- package/dist/server/src/modules/financial-entities/__generated__/types.js.map +1 -1
- package/dist/server/src/modules/financial-entities/helpers/financial-entities.helper.js +4 -1
- package/dist/server/src/modules/financial-entities/helpers/financial-entities.helper.js.map +1 -1
- package/dist/server/src/modules/financial-entities/providers/businesses.provider.d.ts +4 -0
- package/dist/server/src/modules/financial-entities/providers/businesses.provider.js +4 -4
- package/dist/server/src/modules/financial-entities/providers/clients.provider.js +2 -2
- package/dist/server/src/modules/financial-entities/providers/financial-entities.provider.d.ts +2 -0
- package/dist/server/src/modules/financial-entities/providers/financial-entities.provider.js +6 -2
- package/dist/server/src/modules/financial-entities/providers/financial-entities.provider.js.map +1 -1
- package/dist/server/src/modules/financial-entities/resolvers/businesses.resolver.js +11 -0
- package/dist/server/src/modules/financial-entities/resolvers/businesses.resolver.js.map +1 -1
- package/dist/server/src/modules/financial-entities/resolvers/clients.resolvers.js +60 -0
- package/dist/server/src/modules/financial-entities/resolvers/clients.resolvers.js.map +1 -1
- package/dist/server/src/modules/financial-entities/resolvers/common.js +3 -0
- package/dist/server/src/modules/financial-entities/resolvers/common.js.map +1 -1
- package/dist/server/src/modules/financial-entities/resolvers/tax-categories.resolver.js +2 -0
- package/dist/server/src/modules/financial-entities/resolvers/tax-categories.resolver.js.map +1 -1
- package/dist/server/src/modules/financial-entities/typeDefs/businesses.graphql.js +17 -0
- package/dist/server/src/modules/financial-entities/typeDefs/businesses.graphql.js.map +1 -1
- package/dist/server/src/modules/financial-entities/typeDefs/clients.graphql.js +32 -0
- package/dist/server/src/modules/financial-entities/typeDefs/clients.graphql.js.map +1 -1
- package/dist/server/src/modules/financial-entities/typeDefs/financial-entities.graphql.js +3 -0
- package/dist/server/src/modules/financial-entities/typeDefs/financial-entities.graphql.js.map +1 -1
- package/dist/server/src/modules/financial-entities/typeDefs/tax-categories.graphql.js +5 -0
- package/dist/server/src/modules/financial-entities/typeDefs/tax-categories.graphql.js.map +1 -1
- package/dist/server/src/modules/green-invoice/__generated__/types.d.ts +3 -2
- package/dist/server/src/modules/green-invoice/__generated__/types.js.map +1 -1
- package/dist/server/src/modules/green-invoice/resolvers/green-invoice.resolvers.js +18 -0
- package/dist/server/src/modules/green-invoice/resolvers/green-invoice.resolvers.js.map +1 -1
- package/dist/server/src/modules/green-invoice/typeDefs/green-invoice.graphql.js +1 -0
- package/dist/server/src/modules/green-invoice/typeDefs/green-invoice.graphql.js.map +1 -1
- package/package.json +2 -2
- package/src/__generated__/types.ts +184 -4
- package/src/modules/charges/helpers/validate.helper.ts +2 -4
- package/src/modules/contracts/__generated__/contracts.types.ts +161 -0
- package/src/modules/contracts/__generated__/types.ts +21 -3
- package/src/modules/contracts/providers/contracts.provider.ts +171 -1
- package/src/modules/contracts/resolvers/contracts.resolver.ts +67 -2
- package/src/modules/contracts/typeDefs/contracts.graphql.ts +40 -1
- package/src/modules/documents/__generated__/documents.types.ts +35 -0
- package/src/modules/documents/__generated__/types.ts +2 -1
- package/src/modules/documents/providers/documents.provider.ts +36 -1
- package/src/modules/documents/resolvers/documents.resolver.ts +12 -0
- package/src/modules/documents/typeDefs/documents.graphql.ts +1 -0
- package/src/modules/financial-entities/__generated__/businesses.types.ts +8 -3
- package/src/modules/financial-entities/__generated__/clients.types.ts +2 -0
- package/src/modules/financial-entities/__generated__/financial-entities.types.ts +7 -1
- package/src/modules/financial-entities/__generated__/tax-categories.types.ts +2 -0
- package/src/modules/financial-entities/__generated__/types.ts +32 -11
- package/src/modules/financial-entities/helpers/financial-entities.helper.ts +6 -1
- package/src/modules/financial-entities/providers/businesses.provider.ts +4 -4
- package/src/modules/financial-entities/providers/clients.provider.ts +2 -2
- package/src/modules/financial-entities/providers/financial-entities.provider.ts +6 -2
- package/src/modules/financial-entities/resolvers/businesses.resolver.ts +11 -0
- package/src/modules/financial-entities/resolvers/clients.resolvers.ts +66 -1
- package/src/modules/financial-entities/resolvers/common.ts +3 -0
- package/src/modules/financial-entities/resolvers/tax-categories.resolver.ts +2 -0
- package/src/modules/financial-entities/typeDefs/businesses.graphql.ts +17 -0
- package/src/modules/financial-entities/typeDefs/clients.graphql.ts +32 -0
- package/src/modules/financial-entities/typeDefs/financial-entities.graphql.ts +3 -0
- package/src/modules/financial-entities/typeDefs/tax-categories.graphql.ts +5 -0
- package/src/modules/green-invoice/__generated__/types.ts +3 -2
- package/src/modules/green-invoice/resolvers/green-invoice.resolvers.ts +19 -0
- package/src/modules/green-invoice/typeDefs/green-invoice.graphql.ts +1 -0
|
@@ -10,6 +10,7 @@ import type {
|
|
|
10
10
|
IGetAllDocumentsParams,
|
|
11
11
|
IGetAllDocumentsQuery,
|
|
12
12
|
IGetAllDocumentsResult,
|
|
13
|
+
IGetDocumentsByBusinessIdsQuery,
|
|
13
14
|
IGetDocumentsByChargeIdQuery,
|
|
14
15
|
IGetDocumentsByExtendedFiltersParams,
|
|
15
16
|
IGetDocumentsByExtendedFiltersQuery,
|
|
@@ -45,6 +46,12 @@ const getDocumentsByIds = sql<IGetDocumentsByIdsQuery>`
|
|
|
45
46
|
WHERE id IN $$Ids;
|
|
46
47
|
`;
|
|
47
48
|
|
|
49
|
+
const getDocumentsByBusinessIds = sql<IGetDocumentsByBusinessIdsQuery>`
|
|
50
|
+
SELECT *
|
|
51
|
+
FROM accounter_schema.documents
|
|
52
|
+
WHERE debtor_id IN $$Ids OR creditor_id IN $$Ids;
|
|
53
|
+
`;
|
|
54
|
+
|
|
48
55
|
const getDocumentsByHashes = sql<IGetDocumentsByHashesQuery>`
|
|
49
56
|
SELECT *
|
|
50
57
|
FROM accounter_schema.documents
|
|
@@ -369,6 +376,28 @@ export class DocumentsProvider {
|
|
|
369
376
|
},
|
|
370
377
|
);
|
|
371
378
|
|
|
379
|
+
private async batchDocumentsByBusinessIds(businessIds: readonly string[]) {
|
|
380
|
+
const uniqueIDs = [...new Set(businessIds)];
|
|
381
|
+
try {
|
|
382
|
+
const docs = await getDocumentsByBusinessIds.run({ Ids: uniqueIDs }, this.dbProvider);
|
|
383
|
+
|
|
384
|
+
return businessIds.map(id =>
|
|
385
|
+
docs.filter(doc => doc.creditor_id === id || doc.debtor_id === id),
|
|
386
|
+
);
|
|
387
|
+
} catch (e) {
|
|
388
|
+
console.error(e);
|
|
389
|
+
return businessIds.map(() => null);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
public getDocumentsByBusinessIdLoader = new DataLoader(
|
|
394
|
+
(businessIds: readonly string[]) => this.batchDocumentsByBusinessIds(businessIds),
|
|
395
|
+
{
|
|
396
|
+
cacheKeyFn: key => `documents-by-business-${key}`,
|
|
397
|
+
cacheMap: this.cache,
|
|
398
|
+
},
|
|
399
|
+
);
|
|
400
|
+
|
|
372
401
|
private async batchDocumentsByHash(hashes: readonly number[]) {
|
|
373
402
|
const uniqueHashes = [...new Set(hashes)];
|
|
374
403
|
try {
|
|
@@ -442,6 +471,8 @@ export class DocumentsProvider {
|
|
|
442
471
|
if (document) {
|
|
443
472
|
this.cache.delete(`document-by-charge-${document.charge_id}`);
|
|
444
473
|
this.cache.delete(`document-hash-${document.file_hash}`);
|
|
474
|
+
this.cache.delete(`documents-by-business-${document.debtor_id}`);
|
|
475
|
+
this.cache.delete(`documents-by-business-${document.creditor_id}`);
|
|
445
476
|
}
|
|
446
477
|
this.cache.delete(`document-${id}`);
|
|
447
478
|
this.cache.delete('all-documents');
|
|
@@ -449,7 +480,11 @@ export class DocumentsProvider {
|
|
|
449
480
|
|
|
450
481
|
public async invalidateByChargeId(chargeId: string) {
|
|
451
482
|
const documents = await this.getDocumentsByChargeIdLoader.load(chargeId);
|
|
452
|
-
documents.map(doc =>
|
|
483
|
+
documents.map(doc => {
|
|
484
|
+
this.cache.delete(`document-${doc.id}`);
|
|
485
|
+
this.cache.delete(`documents-by-business-${doc.debtor_id}`);
|
|
486
|
+
this.cache.delete(`documents-by-business-${doc.creditor_id}`);
|
|
487
|
+
});
|
|
453
488
|
this.cache.delete(`document-by-charge-${chargeId}`);
|
|
454
489
|
this.cache.delete('all-documents');
|
|
455
490
|
}
|
|
@@ -43,6 +43,18 @@ export const documentsResolvers: DocumentsModule.Resolvers &
|
|
|
43
43
|
const doc = await injector.get(DocumentsProvider).getDocumentsByIdLoader.load(documentId);
|
|
44
44
|
return doc ?? null;
|
|
45
45
|
},
|
|
46
|
+
recentDocumentsByBusiness: async (_, { businessId, limit }, { injector }) => {
|
|
47
|
+
const businessDocs = await injector
|
|
48
|
+
.get(DocumentsProvider)
|
|
49
|
+
.getDocumentsByBusinessIdLoader.load(businessId);
|
|
50
|
+
if (!businessDocs?.length) {
|
|
51
|
+
return [];
|
|
52
|
+
}
|
|
53
|
+
const sortedDocs = [...businessDocs].sort(
|
|
54
|
+
(a, b) => (b.date ?? b.created_at).getTime() - (a.date ?? a.created_at).getTime(),
|
|
55
|
+
);
|
|
56
|
+
return sortedDocs.slice(0, limit ?? 7);
|
|
57
|
+
},
|
|
46
58
|
recentDocumentsByClient: async (_, { clientId, limit }, { injector }) => {
|
|
47
59
|
const clientDocs = await injector
|
|
48
60
|
.get(IssuedDocumentsProvider)
|
|
@@ -5,6 +5,7 @@ export default gql`
|
|
|
5
5
|
documents: [Document!]! @auth(role: ACCOUNTANT)
|
|
6
6
|
documentsByFilters(filters: DocumentsFilters!): [Document!]! @auth(role: ACCOUNTANT)
|
|
7
7
|
documentById(documentId: UUID!): Document @auth(role: ACCOUNTANT)
|
|
8
|
+
recentDocumentsByBusiness(businessId: UUID!, limit: Int): [Document!]! @auth(role: ACCOUNTANT)
|
|
8
9
|
recentDocumentsByClient(clientId: UUID!, limit: Int): [Document!]! @auth(role: ACCOUNTANT)
|
|
9
10
|
recentIssuedDocumentsByType(documentType: DocumentType!, limit: Int): [Document!]!
|
|
10
11
|
@auth(role: ACCOUNTANT)
|
|
@@ -29,6 +29,7 @@ export interface IGetBusinessesByIdsResult {
|
|
|
29
29
|
hebrew_name: string | null;
|
|
30
30
|
id: string;
|
|
31
31
|
irs_code: number | null;
|
|
32
|
+
is_active: boolean;
|
|
32
33
|
is_authority: boolean | null;
|
|
33
34
|
name: string;
|
|
34
35
|
nikuim: string | null;
|
|
@@ -86,6 +87,7 @@ export interface IGetAllBusinessesResult {
|
|
|
86
87
|
hebrew_name: string | null;
|
|
87
88
|
id: string;
|
|
88
89
|
irs_code: number | null;
|
|
90
|
+
is_active: boolean;
|
|
89
91
|
is_authority: boolean | null;
|
|
90
92
|
name: string;
|
|
91
93
|
nikuim: string | null;
|
|
@@ -145,6 +147,7 @@ export interface IGetBusinessByEmailResult {
|
|
|
145
147
|
hebrew_name: string | null;
|
|
146
148
|
id: string;
|
|
147
149
|
irs_code: number | null;
|
|
150
|
+
is_active: boolean;
|
|
148
151
|
is_authority: boolean | null;
|
|
149
152
|
name: string;
|
|
150
153
|
nikuim: string | null;
|
|
@@ -191,14 +194,14 @@ export interface IUpdateBusinessParams {
|
|
|
191
194
|
bankAccountIBAN?: string | null | void;
|
|
192
195
|
bankAccountSwift?: string | null | void;
|
|
193
196
|
businessId?: string | null | void;
|
|
194
|
-
canSettleWithReceipt?: boolean | null | void;
|
|
195
197
|
contract?: string | null | void;
|
|
196
198
|
country?: string | null | void;
|
|
197
199
|
email?: string | null | void;
|
|
198
200
|
exemptDealer?: boolean | null | void;
|
|
199
201
|
hebrewName?: string | null | void;
|
|
202
|
+
isDocumentsOptional?: boolean | null | void;
|
|
203
|
+
isReceiptEnough?: boolean | null | void;
|
|
200
204
|
nikuim?: string | null | void;
|
|
201
|
-
noInvoicesRequired?: boolean | null | void;
|
|
202
205
|
optionalVat?: boolean | null | void;
|
|
203
206
|
password?: string | null | void;
|
|
204
207
|
pcn874RecordTypeOverride?: pcn874_record_type | null | void;
|
|
@@ -281,7 +284,9 @@ export interface IInsertBusinessesParams {
|
|
|
281
284
|
suggestions: Json | null | void,
|
|
282
285
|
optionalVat: boolean | null | void,
|
|
283
286
|
country: string | null | void,
|
|
284
|
-
pcn874RecordTypeOverride: pcn874_record_type | null | void
|
|
287
|
+
pcn874RecordTypeOverride: pcn874_record_type | null | void,
|
|
288
|
+
isReceiptEnough: boolean | null | void,
|
|
289
|
+
isDocumentsOptional: boolean | null | void
|
|
285
290
|
})[];
|
|
286
291
|
}
|
|
287
292
|
|
|
@@ -107,6 +107,8 @@ export interface IDeleteClientQuery {
|
|
|
107
107
|
|
|
108
108
|
/** 'InsertClient' parameters type */
|
|
109
109
|
export interface IInsertClientParams {
|
|
110
|
+
businessId?: string | null | void;
|
|
111
|
+
emails?: stringArray | null | void;
|
|
110
112
|
greenInvoiceId?: string | null | void;
|
|
111
113
|
hiveId?: string | null | void;
|
|
112
114
|
}
|
|
@@ -10,6 +10,7 @@ export interface IGetFinancialEntitiesByIdsResult {
|
|
|
10
10
|
created_at: Date;
|
|
11
11
|
id: string;
|
|
12
12
|
irs_code: number | null;
|
|
13
|
+
is_active: boolean;
|
|
13
14
|
name: string;
|
|
14
15
|
owner_id: string | null;
|
|
15
16
|
sort_code: number | null;
|
|
@@ -31,6 +32,7 @@ export interface IGetAllFinancialEntitiesResult {
|
|
|
31
32
|
created_at: Date;
|
|
32
33
|
id: string;
|
|
33
34
|
irs_code: number | null;
|
|
35
|
+
is_active: boolean;
|
|
34
36
|
name: string;
|
|
35
37
|
owner_id: string | null;
|
|
36
38
|
sort_code: number | null;
|
|
@@ -48,6 +50,7 @@ export interface IGetAllFinancialEntitiesQuery {
|
|
|
48
50
|
export interface IUpdateFinancialEntityParams {
|
|
49
51
|
financialEntityId?: string | null | void;
|
|
50
52
|
irsCode?: number | null | void;
|
|
53
|
+
isActive?: boolean | null | void;
|
|
51
54
|
name?: string | null | void;
|
|
52
55
|
ownerId?: string | null | void;
|
|
53
56
|
sortCode?: number | null | void;
|
|
@@ -59,6 +62,7 @@ export interface IUpdateFinancialEntityResult {
|
|
|
59
62
|
created_at: Date;
|
|
60
63
|
id: string;
|
|
61
64
|
irs_code: number | null;
|
|
65
|
+
is_active: boolean;
|
|
62
66
|
name: string;
|
|
63
67
|
owner_id: string | null;
|
|
64
68
|
sort_code: number | null;
|
|
@@ -79,7 +83,8 @@ export interface IInsertFinancialEntitiesParams {
|
|
|
79
83
|
ownerId: string | null | void,
|
|
80
84
|
name: string | null | void,
|
|
81
85
|
sortCode: number | null | void,
|
|
82
|
-
irsCode: number | null | void
|
|
86
|
+
irsCode: number | null | void,
|
|
87
|
+
isActive: boolean | null | void
|
|
83
88
|
})[];
|
|
84
89
|
}
|
|
85
90
|
|
|
@@ -88,6 +93,7 @@ export interface IInsertFinancialEntitiesResult {
|
|
|
88
93
|
created_at: Date;
|
|
89
94
|
id: string;
|
|
90
95
|
irs_code: number | null;
|
|
96
|
+
is_active: boolean;
|
|
91
97
|
name: string;
|
|
92
98
|
owner_id: string | null;
|
|
93
99
|
sort_code: number | null;
|
|
@@ -122,6 +122,7 @@ export interface IGetTaxCategoryByIDsResult {
|
|
|
122
122
|
hashavshevet_name: string | null;
|
|
123
123
|
id: string;
|
|
124
124
|
irs_code: number | null;
|
|
125
|
+
is_active: boolean;
|
|
125
126
|
name: string;
|
|
126
127
|
owner_id: string | null;
|
|
127
128
|
sort_code: number | null;
|
|
@@ -145,6 +146,7 @@ export interface IGetAllTaxCategoriesResult {
|
|
|
145
146
|
hashavshevet_name: string | null;
|
|
146
147
|
id: string;
|
|
147
148
|
irs_code: number | null;
|
|
149
|
+
is_active: boolean;
|
|
148
150
|
name: string;
|
|
149
151
|
owner_id: string | null;
|
|
150
152
|
sort_code: number | null;
|
|
@@ -10,14 +10,14 @@ export namespace FinancialEntitiesModule {
|
|
|
10
10
|
BusinessTransactionsFromLedgerRecordsSuccessfulResult: 'businessTransactions';
|
|
11
11
|
BusinessTransaction: 'amount' | 'business' | 'foreignAmount' | 'invoiceDate' | 'reference' | 'details' | 'counterAccount' | 'chargeId';
|
|
12
12
|
PaginatedBusinesses: 'nodes' | 'pageInfo';
|
|
13
|
-
LtdFinancialEntity: 'id' | 'country' | 'governmentId' | 'name' | 'address' | 'hebrewName' | 'email' | 'website' | 'phoneNumber' | 'exemptDealer' | 'optionalVAT' | 'suggestions' | 'pcn874RecordType' | 'irsCode' | 'taxCategory';
|
|
13
|
+
LtdFinancialEntity: 'id' | 'country' | 'governmentId' | 'name' | 'address' | 'hebrewName' | 'email' | 'website' | 'phoneNumber' | 'exemptDealer' | 'optionalVAT' | 'suggestions' | 'pcn874RecordType' | 'irsCode' | 'isActive' | 'isReceiptEnough' | 'isDocumentsOptional' | 'createdAt' | 'updatedAt' | 'clientInfo' | 'taxCategory';
|
|
14
14
|
Suggestions: 'phrases' | 'tags' | 'description' | 'emails' | 'emailListener' | 'priority';
|
|
15
15
|
SuggestionsEmailListenerConfig: 'internalEmailLinks' | 'emailBody' | 'attachments';
|
|
16
|
-
PersonalFinancialEntity: 'id' | 'name' | 'email' | 'pcn874RecordType' | 'irsCode';
|
|
17
|
-
Mutation: 'updateBusiness' | 'insertNewBusiness' | 'mergeBusinesses' | 'batchGenerateBusinessesOutOfTransactions' | 'updateTaxCategory' | 'insertTaxCategory';
|
|
18
|
-
Client: 'id' | 'originalBusiness' | 'greenInvoiceId' | 'emails' | 'generatedDocumentType' | 'greenInvoiceInfo';
|
|
16
|
+
PersonalFinancialEntity: 'id' | 'name' | 'email' | 'pcn874RecordType' | 'irsCode' | 'isActive' | 'createdAt' | 'updatedAt';
|
|
17
|
+
Mutation: 'updateBusiness' | 'insertNewBusiness' | 'mergeBusinesses' | 'batchGenerateBusinessesOutOfTransactions' | 'updateClient' | 'insertClient' | 'updateTaxCategory' | 'insertTaxCategory';
|
|
18
|
+
Client: 'id' | 'originalBusiness' | 'greenInvoiceId' | 'hiveId' | 'emails' | 'generatedDocumentType' | 'greenInvoiceInfo';
|
|
19
19
|
PaginatedFinancialEntities: 'nodes' | 'pageInfo';
|
|
20
|
-
TaxCategory: 'id' | 'name' | 'irsCode';
|
|
20
|
+
TaxCategory: 'id' | 'name' | 'irsCode' | 'createdAt' | 'updatedAt' | 'isActive';
|
|
21
21
|
CommonCharge: 'owner' | 'counterparty' | 'taxCategory';
|
|
22
22
|
FinancialCharge: 'owner' | 'counterparty' | 'taxCategory';
|
|
23
23
|
ConversionCharge: 'owner' | 'counterparty' | 'taxCategory';
|
|
@@ -37,8 +37,8 @@ export namespace FinancialEntitiesModule {
|
|
|
37
37
|
InvoiceReceipt: 'creditor' | 'debtor';
|
|
38
38
|
CreditInvoice: 'creditor' | 'debtor';
|
|
39
39
|
LedgerRecord: 'debitAccount1' | 'debitAccount2' | 'creditAccount1' | 'creditAccount2';
|
|
40
|
-
Business: 'id' | 'name' | 'pcn874RecordType' | 'irsCode';
|
|
41
|
-
FinancialEntity: 'id' | 'name' | 'irsCode';
|
|
40
|
+
Business: 'id' | 'name' | 'pcn874RecordType' | 'irsCode' | 'isActive' | 'createdAt' | 'updatedAt';
|
|
41
|
+
FinancialEntity: 'id' | 'name' | 'irsCode' | 'createdAt' | 'updatedAt' | 'isActive';
|
|
42
42
|
Charge: 'owner' | 'counterparty' | 'taxCategory';
|
|
43
43
|
Transaction: 'counterparty';
|
|
44
44
|
FinancialDocument: 'creditor' | 'debtor';
|
|
@@ -51,12 +51,14 @@ export namespace FinancialEntitiesModule {
|
|
|
51
51
|
|
|
52
52
|
interface DefinedInputFields {
|
|
53
53
|
BusinessTransactionsFilter: 'businessIDs' | 'ownerIds' | 'type' | 'fromDate' | 'toDate' | 'includeRevaluation';
|
|
54
|
-
UpdateBusinessInput: 'name' | 'sortCode' | 'country' | 'hebrewName' | 'address' | 'email' | 'website' | 'phoneNumber' | 'governmentId' | 'taxCategory' | 'exemptDealer' | 'suggestions' | 'optionalVAT' | 'pcn874RecordType' | 'irsCode';
|
|
55
|
-
InsertNewBusinessInput: 'name' | 'sortCode' | 'country' | 'hebrewName' | 'address' | 'email' | 'website' | 'phoneNumber' | 'governmentId' | 'taxCategory' | 'exemptDealer' | 'suggestions' | 'optionalVAT' | 'pcn874RecordType' | 'irsCode';
|
|
54
|
+
UpdateBusinessInput: 'name' | 'sortCode' | 'country' | 'hebrewName' | 'address' | 'email' | 'website' | 'phoneNumber' | 'governmentId' | 'taxCategory' | 'exemptDealer' | 'suggestions' | 'optionalVAT' | 'isReceiptEnough' | 'isDocumentsOptional' | 'pcn874RecordType' | 'irsCode' | 'isActive';
|
|
55
|
+
InsertNewBusinessInput: 'name' | 'sortCode' | 'country' | 'hebrewName' | 'address' | 'email' | 'website' | 'phoneNumber' | 'governmentId' | 'taxCategory' | 'exemptDealer' | 'suggestions' | 'optionalVAT' | 'isReceiptEnough' | 'isDocumentsOptional' | 'pcn874RecordType' | 'irsCode' | 'isActive';
|
|
56
56
|
SuggestionsInput: 'phrases' | 'tags' | 'description' | 'emails' | 'emailListener' | 'priority';
|
|
57
57
|
SuggestionsEmailListenerConfigInput: 'internalEmailLinks' | 'emailBody' | 'attachments';
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
ClientInsertInput: 'businessId' | 'greenInvoiceId' | 'hiveId' | 'emails' | 'generatedDocumentType';
|
|
59
|
+
ClientUpdateInput: 'greenInvoiceId' | 'hiveId' | 'emails' | 'generatedDocumentType' | 'newBusinessId';
|
|
60
|
+
UpdateTaxCategoryInput: 'name' | 'sortCode' | 'irsCode' | 'isActive' | 'hashavshevetName' | 'taxExcluded';
|
|
61
|
+
InsertTaxCategoryInput: 'name' | 'sortCode' | 'irsCode' | 'hashavshevetName' | 'taxExcluded' | 'isActive';
|
|
60
62
|
UpdateChargeInput: 'counterpartyId' | 'ownerId';
|
|
61
63
|
};
|
|
62
64
|
|
|
@@ -81,6 +83,7 @@ export namespace FinancialEntitiesModule {
|
|
|
81
83
|
export type Business = Pick<Types.Business, DefinedFields['Business']>;
|
|
82
84
|
export type PaginatedBusinesses = Pick<Types.PaginatedBusinesses, DefinedFields['PaginatedBusinesses']>;
|
|
83
85
|
export type Pcn874RecordType = Types.Pcn874RecordType;
|
|
86
|
+
export type DateTime = Types.DateTime;
|
|
84
87
|
export type PageInfo = Types.PageInfo;
|
|
85
88
|
export type Suggestions = Pick<Types.Suggestions, DefinedFields['Suggestions']>;
|
|
86
89
|
export type Tag = Types.Tag;
|
|
@@ -107,6 +110,9 @@ export namespace FinancialEntitiesModule {
|
|
|
107
110
|
export type ForeignSecuritiesCharge = Types.ForeignSecuritiesCharge;
|
|
108
111
|
export type CreditcardBankCharge = Types.CreditcardBankCharge;
|
|
109
112
|
export type Client = Pick<Types.Client, DefinedFields['Client']>;
|
|
113
|
+
export type UpdateClientResponse = Types.UpdateClientResponse;
|
|
114
|
+
export type ClientUpdateInput = Pick<Types.ClientUpdateInput, DefinedInputFields['ClientUpdateInput']>;
|
|
115
|
+
export type ClientInsertInput = Pick<Types.ClientInsertInput, DefinedInputFields['ClientInsertInput']>;
|
|
110
116
|
export type DocumentType = Types.DocumentType;
|
|
111
117
|
export type GreenInvoiceClient = Types.GreenInvoiceClient;
|
|
112
118
|
export type PaginatedFinancialEntities = Pick<Types.PaginatedFinancialEntities, DefinedFields['PaginatedFinancialEntities']>;
|
|
@@ -288,6 +294,12 @@ export namespace FinancialEntitiesModule {
|
|
|
288
294
|
suggestions?: gm.Middleware[];
|
|
289
295
|
pcn874RecordType?: gm.Middleware[];
|
|
290
296
|
irsCode?: gm.Middleware[];
|
|
297
|
+
isActive?: gm.Middleware[];
|
|
298
|
+
isReceiptEnough?: gm.Middleware[];
|
|
299
|
+
isDocumentsOptional?: gm.Middleware[];
|
|
300
|
+
createdAt?: gm.Middleware[];
|
|
301
|
+
updatedAt?: gm.Middleware[];
|
|
302
|
+
clientInfo?: gm.Middleware[];
|
|
291
303
|
taxCategory?: gm.Middleware[];
|
|
292
304
|
};
|
|
293
305
|
Suggestions?: {
|
|
@@ -312,6 +324,9 @@ export namespace FinancialEntitiesModule {
|
|
|
312
324
|
email?: gm.Middleware[];
|
|
313
325
|
pcn874RecordType?: gm.Middleware[];
|
|
314
326
|
irsCode?: gm.Middleware[];
|
|
327
|
+
isActive?: gm.Middleware[];
|
|
328
|
+
createdAt?: gm.Middleware[];
|
|
329
|
+
updatedAt?: gm.Middleware[];
|
|
315
330
|
};
|
|
316
331
|
Mutation?: {
|
|
317
332
|
'*'?: gm.Middleware[];
|
|
@@ -319,6 +334,8 @@ export namespace FinancialEntitiesModule {
|
|
|
319
334
|
insertNewBusiness?: gm.Middleware[];
|
|
320
335
|
mergeBusinesses?: gm.Middleware[];
|
|
321
336
|
batchGenerateBusinessesOutOfTransactions?: gm.Middleware[];
|
|
337
|
+
updateClient?: gm.Middleware[];
|
|
338
|
+
insertClient?: gm.Middleware[];
|
|
322
339
|
updateTaxCategory?: gm.Middleware[];
|
|
323
340
|
insertTaxCategory?: gm.Middleware[];
|
|
324
341
|
};
|
|
@@ -393,6 +410,7 @@ export namespace FinancialEntitiesModule {
|
|
|
393
410
|
id?: gm.Middleware[];
|
|
394
411
|
originalBusiness?: gm.Middleware[];
|
|
395
412
|
greenInvoiceId?: gm.Middleware[];
|
|
413
|
+
hiveId?: gm.Middleware[];
|
|
396
414
|
emails?: gm.Middleware[];
|
|
397
415
|
generatedDocumentType?: gm.Middleware[];
|
|
398
416
|
greenInvoiceInfo?: gm.Middleware[];
|
|
@@ -447,6 +465,9 @@ export namespace FinancialEntitiesModule {
|
|
|
447
465
|
id?: gm.Middleware[];
|
|
448
466
|
name?: gm.Middleware[];
|
|
449
467
|
irsCode?: gm.Middleware[];
|
|
468
|
+
createdAt?: gm.Middleware[];
|
|
469
|
+
updatedAt?: gm.Middleware[];
|
|
470
|
+
isActive?: gm.Middleware[];
|
|
450
471
|
};
|
|
451
472
|
};
|
|
452
473
|
}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
export function hasFinancialEntitiesCoreProperties(proto: object): boolean {
|
|
2
2
|
const keys = Object.keys(proto);
|
|
3
|
-
return
|
|
3
|
+
return (
|
|
4
|
+
keys.includes('name') ||
|
|
5
|
+
keys.includes('sortCode') ||
|
|
6
|
+
keys.includes('irsCode') ||
|
|
7
|
+
keys.includes('isActive')
|
|
8
|
+
);
|
|
4
9
|
}
|
|
@@ -159,7 +159,7 @@ const updateBusiness = sql<IUpdateBusinessQuery>`
|
|
|
159
159
|
registration_date
|
|
160
160
|
),
|
|
161
161
|
no_invoices_required = COALESCE(
|
|
162
|
-
$
|
|
162
|
+
$isDocumentsOptional,
|
|
163
163
|
no_invoices_required
|
|
164
164
|
),
|
|
165
165
|
suggestion_data = COALESCE(
|
|
@@ -167,7 +167,7 @@ const updateBusiness = sql<IUpdateBusinessQuery>`
|
|
|
167
167
|
suggestion_data
|
|
168
168
|
),
|
|
169
169
|
can_settle_with_receipt = COALESCE(
|
|
170
|
-
$
|
|
170
|
+
$isReceiptEnough,
|
|
171
171
|
can_settle_with_receipt
|
|
172
172
|
),
|
|
173
173
|
exempt_dealer = COALESCE(
|
|
@@ -188,8 +188,8 @@ const updateBusiness = sql<IUpdateBusinessQuery>`
|
|
|
188
188
|
`;
|
|
189
189
|
|
|
190
190
|
const insertBusinesses = sql<IInsertBusinessesQuery>`
|
|
191
|
-
INSERT INTO accounter_schema.businesses (id, hebrew_name, address, email, website, phone_number, vat_number, exempt_dealer, suggestion_data, optional_vat, country, pcn874_record_type_override)
|
|
192
|
-
VALUES $$businesses(id, hebrewName, address, email, website, phoneNumber, governmentId, exemptDealer, suggestions, optionalVat, country, pcn874RecordTypeOverride)
|
|
191
|
+
INSERT INTO accounter_schema.businesses (id, hebrew_name, address, email, website, phone_number, vat_number, exempt_dealer, suggestion_data, optional_vat, country, pcn874_record_type_override, can_settle_with_receipt, no_invoices_required)
|
|
192
|
+
VALUES $$businesses(id, hebrewName, address, email, website, phoneNumber, governmentId, exemptDealer, suggestions, optionalVat, country, pcn874RecordTypeOverride, isReceiptEnough, isDocumentsOptional)
|
|
193
193
|
RETURNING *;`;
|
|
194
194
|
|
|
195
195
|
const replaceBusinesses = sql<IReplaceBusinessesQuery>`
|
|
@@ -67,8 +67,8 @@ const deleteClient = sql<IDeleteClientQuery>`
|
|
|
67
67
|
`;
|
|
68
68
|
|
|
69
69
|
const insertClient = sql<IInsertClientQuery>`
|
|
70
|
-
INSERT INTO accounter_schema.clients (green_invoice_id, hive_id)
|
|
71
|
-
VALUES ($greenInvoiceId, $hiveId)
|
|
70
|
+
INSERT INTO accounter_schema.clients (business_id, green_invoice_id, hive_id, emails)
|
|
71
|
+
VALUES ($businessId, $greenInvoiceId, $hiveId, $emails)
|
|
72
72
|
RETURNING *;`;
|
|
73
73
|
|
|
74
74
|
@Injectable({
|
|
@@ -49,6 +49,10 @@ const updateFinancialEntity = sql<IUpdateFinancialEntityQuery>`
|
|
|
49
49
|
irs_code = COALESCE(
|
|
50
50
|
$irsCode,
|
|
51
51
|
irs_code
|
|
52
|
+
),
|
|
53
|
+
is_active = COALESCE(
|
|
54
|
+
$isActive,
|
|
55
|
+
is_active
|
|
52
56
|
)
|
|
53
57
|
WHERE
|
|
54
58
|
id = $financialEntityId
|
|
@@ -56,8 +60,8 @@ const updateFinancialEntity = sql<IUpdateFinancialEntityQuery>`
|
|
|
56
60
|
`;
|
|
57
61
|
|
|
58
62
|
const insertFinancialEntities = sql<IInsertFinancialEntitiesQuery>`
|
|
59
|
-
INSERT INTO accounter_schema.financial_entities (type, owner_id, name, sort_code, irs_code)
|
|
60
|
-
VALUES $$financialEntities(type, ownerId, name, sortCode, irsCode)
|
|
63
|
+
INSERT INTO accounter_schema.financial_entities (type, owner_id, name, sort_code, irs_code, is_active)
|
|
64
|
+
VALUES $$financialEntities(type, ownerId, name, sortCode, irsCode, isActive)
|
|
61
65
|
RETURNING *;`;
|
|
62
66
|
|
|
63
67
|
const deleteFinancialEntity = sql<IDeleteFinancialEntityQuery>`
|
|
@@ -77,6 +77,7 @@ export const businessesResolvers: FinancialEntitiesModule.Resolvers &
|
|
|
77
77
|
...fields,
|
|
78
78
|
financialEntityId: businessId,
|
|
79
79
|
irsCode: fields.irsCode ?? null,
|
|
80
|
+
isActive: fields.isActive ?? null,
|
|
80
81
|
});
|
|
81
82
|
}
|
|
82
83
|
|
|
@@ -102,6 +103,8 @@ export const businessesResolvers: FinancialEntitiesModule.Resolvers &
|
|
|
102
103
|
phoneNumber: fields.phoneNumber,
|
|
103
104
|
website: fields.website,
|
|
104
105
|
optionalVat: fields.optionalVAT,
|
|
106
|
+
isReceiptEnough: fields.isReceiptEnough ?? null,
|
|
107
|
+
isDocumentsOptional: fields.isDocumentsOptional ?? null,
|
|
105
108
|
country: fields.country,
|
|
106
109
|
suggestionData,
|
|
107
110
|
pcn874RecordTypeOverride: fields.pcn874RecordType,
|
|
@@ -190,6 +193,7 @@ export const businessesResolvers: FinancialEntitiesModule.Resolvers &
|
|
|
190
193
|
sortCode: fields.sortCode,
|
|
191
194
|
type: 'business',
|
|
192
195
|
irsCode,
|
|
196
|
+
isActive: fields.isActive ?? true,
|
|
193
197
|
})
|
|
194
198
|
.catch((e: Error) => {
|
|
195
199
|
console.error(e);
|
|
@@ -235,6 +239,8 @@ export const businessesResolvers: FinancialEntitiesModule.Resolvers &
|
|
|
235
239
|
phoneNumber: fields.phoneNumber,
|
|
236
240
|
website: fields.website,
|
|
237
241
|
optionalVat: fields.optionalVAT,
|
|
242
|
+
isReceiptEnough: fields.isReceiptEnough ?? null,
|
|
243
|
+
isDocumentsOptional: fields.isDocumentsOptional ?? null,
|
|
238
244
|
country: fields.country,
|
|
239
245
|
suggestions,
|
|
240
246
|
pcn874RecordTypeOverride: fields.pcn874RecordType,
|
|
@@ -459,6 +465,7 @@ export const businessesResolvers: FinancialEntitiesModule.Resolvers &
|
|
|
459
465
|
type: 'business',
|
|
460
466
|
sortCode: null,
|
|
461
467
|
irsCode: null,
|
|
468
|
+
isActive: true,
|
|
462
469
|
})
|
|
463
470
|
.catch((e: Error) => {
|
|
464
471
|
console.error(e);
|
|
@@ -485,6 +492,8 @@ export const businessesResolvers: FinancialEntitiesModule.Resolvers &
|
|
|
485
492
|
governmentId: undefined,
|
|
486
493
|
exemptDealer: false,
|
|
487
494
|
optionalVat: false,
|
|
495
|
+
isReceiptEnough: null,
|
|
496
|
+
isDocumentsOptional: null,
|
|
488
497
|
pcn874RecordTypeOverride: null,
|
|
489
498
|
});
|
|
490
499
|
|
|
@@ -563,6 +572,8 @@ export const businessesResolvers: FinancialEntitiesModule.Resolvers &
|
|
|
563
572
|
},
|
|
564
573
|
optionalVAT: DbBusiness => DbBusiness.optional_vat,
|
|
565
574
|
pcn874RecordType: DbBusiness => DbBusiness.pcn874_record_type_override,
|
|
575
|
+
isReceiptEnough: DbBusiness => DbBusiness.can_settle_with_receipt,
|
|
576
|
+
isDocumentsOptional: DbBusiness => DbBusiness.no_invoices_required,
|
|
566
577
|
},
|
|
567
578
|
PersonalFinancialEntity: {
|
|
568
579
|
...commonFinancialEntityFields,
|
|
@@ -2,7 +2,11 @@ import { GraphQLError } from 'graphql';
|
|
|
2
2
|
import { GreenInvoiceClientProvider } from '@modules/app-providers/green-invoice-client.js';
|
|
3
3
|
import { BusinessesProvider } from '@modules/financial-entities/providers/businesses.provider.js';
|
|
4
4
|
import { ClientsProvider } from '../providers/clients.provider.js';
|
|
5
|
-
import type {
|
|
5
|
+
import type {
|
|
6
|
+
FinancialEntitiesModule,
|
|
7
|
+
IInsertClientParams,
|
|
8
|
+
IUpdateClientParams,
|
|
9
|
+
} from '../types.js';
|
|
6
10
|
|
|
7
11
|
export const clientsResolvers: FinancialEntitiesModule.Resolvers = {
|
|
8
12
|
Query: {
|
|
@@ -33,6 +37,59 @@ export const clientsResolvers: FinancialEntitiesModule.Resolvers = {
|
|
|
33
37
|
}
|
|
34
38
|
},
|
|
35
39
|
},
|
|
40
|
+
Mutation: {
|
|
41
|
+
updateClient: async (_, { businessId, fields }, { injector }) => {
|
|
42
|
+
const adjustedFields: IUpdateClientParams = {
|
|
43
|
+
businessId,
|
|
44
|
+
emails: fields.emails ? [...fields.emails] : undefined,
|
|
45
|
+
greenInvoiceId: fields.greenInvoiceId,
|
|
46
|
+
hiveId: fields.hiveId,
|
|
47
|
+
newBusinessId: fields.newBusinessId,
|
|
48
|
+
};
|
|
49
|
+
try {
|
|
50
|
+
const [updatedClient] = await injector
|
|
51
|
+
.get(ClientsProvider)
|
|
52
|
+
.updateClient({ ...adjustedFields, businessId })
|
|
53
|
+
.catch((e: Error) => {
|
|
54
|
+
const message = `Error updating client ID="${businessId}"`;
|
|
55
|
+
console.error(`${message}: ${e}`);
|
|
56
|
+
if (e instanceof GraphQLError) {
|
|
57
|
+
throw e;
|
|
58
|
+
}
|
|
59
|
+
throw new Error(message);
|
|
60
|
+
});
|
|
61
|
+
return updatedClient;
|
|
62
|
+
} catch (e) {
|
|
63
|
+
return {
|
|
64
|
+
__typename: 'CommonError',
|
|
65
|
+
message: `Failed to update client ID="${businessId}": ${(e as Error).message}`,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
insertClient: async (_, { fields }, { injector }) => {
|
|
70
|
+
try {
|
|
71
|
+
const newClient: IInsertClientParams = {
|
|
72
|
+
businessId: fields.businessId,
|
|
73
|
+
emails: fields.emails ? [...fields.emails] : [],
|
|
74
|
+
greenInvoiceId: fields.greenInvoiceId,
|
|
75
|
+
hiveId: fields.hiveId,
|
|
76
|
+
};
|
|
77
|
+
const [insertClient] = await injector.get(ClientsProvider).insertClient(newClient);
|
|
78
|
+
|
|
79
|
+
if (!insertClient) {
|
|
80
|
+
throw new Error(`No client returned after insertion`);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return insertClient;
|
|
84
|
+
} catch (e) {
|
|
85
|
+
console.error(e);
|
|
86
|
+
return {
|
|
87
|
+
__typename: 'CommonError',
|
|
88
|
+
message: `Failed to create Client`,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
},
|
|
36
93
|
Client: {
|
|
37
94
|
id: business => business.green_invoice_id,
|
|
38
95
|
originalBusiness: async (business, _, { injector }) => {
|
|
@@ -47,6 +104,7 @@ export const clientsResolvers: FinancialEntitiesModule.Resolvers = {
|
|
|
47
104
|
return businessMatch;
|
|
48
105
|
},
|
|
49
106
|
greenInvoiceId: business => business.green_invoice_id,
|
|
107
|
+
hiveId: business => business.hive_id,
|
|
50
108
|
emails: business => business.emails ?? [],
|
|
51
109
|
greenInvoiceInfo: async (business, _, { injector }) => {
|
|
52
110
|
const client = await injector
|
|
@@ -65,4 +123,11 @@ export const clientsResolvers: FinancialEntitiesModule.Resolvers = {
|
|
|
65
123
|
};
|
|
66
124
|
},
|
|
67
125
|
},
|
|
126
|
+
LtdFinancialEntity: {
|
|
127
|
+
clientInfo: async (business, _, { injector }) => {
|
|
128
|
+
const client = await injector.get(ClientsProvider).getClientByIdLoader.load(business.id);
|
|
129
|
+
|
|
130
|
+
return client || null;
|
|
131
|
+
},
|
|
132
|
+
},
|
|
68
133
|
};
|
|
@@ -12,6 +12,9 @@ export const commonFinancialEntityFields:
|
|
|
12
12
|
id: dbFinancialEntity => dbFinancialEntity.id,
|
|
13
13
|
name: dbFinancialEntity => dbFinancialEntity.name,
|
|
14
14
|
irsCode: dbFinancialEntity => dbFinancialEntity.irs_code,
|
|
15
|
+
isActive: dbFinancialEntity => !!dbFinancialEntity.is_active,
|
|
16
|
+
createdAt: dbFinancialEntity => dbFinancialEntity.created_at,
|
|
17
|
+
updatedAt: dbFinancialEntity => dbFinancialEntity.updated_at,
|
|
15
18
|
};
|
|
16
19
|
|
|
17
20
|
export const commonTaxChargeFields: FinancialEntitiesModule.ChargeResolvers = {
|
|
@@ -42,6 +42,7 @@ export const taxCategoriesResolvers: FinancialEntitiesModule.Resolvers = {
|
|
|
42
42
|
...fields,
|
|
43
43
|
financialEntityId: taxCategoryId,
|
|
44
44
|
irsCode: fields.irsCode ?? null,
|
|
45
|
+
isActive: fields.isActive ?? true,
|
|
45
46
|
});
|
|
46
47
|
}
|
|
47
48
|
const adjustedFields: IUpdateTaxCategoryParams = {
|
|
@@ -98,6 +99,7 @@ export const taxCategoriesResolvers: FinancialEntitiesModule.Resolvers = {
|
|
|
98
99
|
sortCode: fields.sortCode,
|
|
99
100
|
type: 'tax_category',
|
|
100
101
|
irsCode,
|
|
102
|
+
isActive: fields.isActive ?? true,
|
|
101
103
|
})
|
|
102
104
|
.catch((e: Error) => {
|
|
103
105
|
const message = `Failed to create financial entity: ${e.message}`;
|
|
@@ -14,6 +14,9 @@ export default gql`
|
|
|
14
14
|
|
|
15
15
|
pcn874RecordType: Pcn874RecordType
|
|
16
16
|
irsCode: Int
|
|
17
|
+
isActive: Boolean!
|
|
18
|
+
createdAt: DateTime!
|
|
19
|
+
updatedAt: DateTime!
|
|
17
20
|
}
|
|
18
21
|
|
|
19
22
|
" response for paginated Financial Entities "
|
|
@@ -41,6 +44,11 @@ export default gql`
|
|
|
41
44
|
|
|
42
45
|
pcn874RecordType: Pcn874RecordType
|
|
43
46
|
irsCode: Int
|
|
47
|
+
isActive: Boolean!
|
|
48
|
+
isReceiptEnough: Boolean
|
|
49
|
+
isDocumentsOptional: Boolean
|
|
50
|
+
createdAt: DateTime!
|
|
51
|
+
updatedAt: DateTime!
|
|
44
52
|
}
|
|
45
53
|
|
|
46
54
|
" input for business suggestions "
|
|
@@ -74,6 +82,9 @@ export default gql`
|
|
|
74
82
|
|
|
75
83
|
pcn874RecordType: Pcn874RecordType
|
|
76
84
|
irsCode: Int
|
|
85
|
+
isActive: Boolean!
|
|
86
|
+
createdAt: DateTime!
|
|
87
|
+
updatedAt: DateTime!
|
|
77
88
|
}
|
|
78
89
|
|
|
79
90
|
extend type Mutation {
|
|
@@ -108,9 +119,12 @@ export default gql`
|
|
|
108
119
|
exemptDealer: Boolean
|
|
109
120
|
suggestions: SuggestionsInput
|
|
110
121
|
optionalVAT: Boolean
|
|
122
|
+
isReceiptEnough: Boolean
|
|
123
|
+
isDocumentsOptional: Boolean
|
|
111
124
|
|
|
112
125
|
pcn874RecordType: Pcn874RecordType
|
|
113
126
|
irsCode: Int
|
|
127
|
+
isActive: Boolean
|
|
114
128
|
}
|
|
115
129
|
|
|
116
130
|
" input for insertNewBusiness "
|
|
@@ -129,8 +143,11 @@ export default gql`
|
|
|
129
143
|
exemptDealer: Boolean
|
|
130
144
|
suggestions: SuggestionsInput
|
|
131
145
|
optionalVAT: Boolean
|
|
146
|
+
isReceiptEnough: Boolean
|
|
147
|
+
isDocumentsOptional: Boolean
|
|
132
148
|
pcn874RecordType: Pcn874RecordType
|
|
133
149
|
irsCode: Int
|
|
150
|
+
isActive: Boolean
|
|
134
151
|
}
|
|
135
152
|
|
|
136
153
|
" input for business suggestions "
|