@accounter/server 0.0.8-alpha-20251029233659-8fb74309c9f1de4f20423db029c5740e2df4bb5d → 0.0.8-alpha-20251029234818-bb69914cb7aaa4859296baa4a256c251158fd15b
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 +33 -4
- package/dist/green-invoice-graphql/src/mesh-artifacts/index.d.ts +1 -1
- package/dist/server/src/__generated__/types.d.ts +82 -18
- package/dist/server/src/__generated__/types.js.map +1 -1
- package/dist/server/src/modules/financial-entities/__generated__/admin-businesses.types.d.ts +57 -0
- package/dist/server/src/modules/financial-entities/__generated__/admin-businesses.types.js +0 -1
- package/dist/server/src/modules/financial-entities/__generated__/admin-businesses.types.js.map +1 -1
- package/dist/server/src/modules/financial-entities/__generated__/types.d.ts +33 -10
- package/dist/server/src/modules/financial-entities/__generated__/types.js.map +1 -1
- package/dist/server/src/modules/financial-entities/helpers/admin-businesses.helper.d.ts +31 -0
- package/dist/server/src/modules/financial-entities/helpers/admin-businesses.helper.js +27 -0
- package/dist/server/src/modules/financial-entities/helpers/admin-businesses.helper.js.map +1 -0
- package/dist/server/src/modules/financial-entities/providers/admin-businesses.provider.d.ts +2 -1
- package/dist/server/src/modules/financial-entities/providers/admin-businesses.provider.js +37 -0
- package/dist/server/src/modules/financial-entities/providers/admin-businesses.provider.js.map +1 -1
- package/dist/server/src/modules/financial-entities/resolvers/admin-businesses.resolver.js +46 -11
- package/dist/server/src/modules/financial-entities/resolvers/admin-businesses.resolver.js.map +1 -1
- package/dist/server/src/modules/financial-entities/typeDefs/admin-businesses.graphql.js +49 -16
- package/dist/server/src/modules/financial-entities/typeDefs/admin-businesses.graphql.js.map +1 -1
- package/dist/server/src/modules/financial-entities/types.d.ts +1 -1
- package/dist/server/src/modules/ledger/__generated__/types.d.ts +3 -2
- package/dist/server/src/modules/ledger/__generated__/types.js.map +1 -1
- package/dist/server/src/modules/ledger/resolvers/ledger.resolver.js +5 -0
- package/dist/server/src/modules/ledger/resolvers/ledger.resolver.js.map +1 -1
- package/dist/server/src/modules/ledger/typeDefs/ledger.graphql.js +2 -0
- package/dist/server/src/modules/ledger/typeDefs/ledger.graphql.js.map +1 -1
- package/dist/server/src/modules/transactions/__generated__/types.d.ts +2 -1
- package/dist/server/src/modules/transactions/__generated__/types.js.map +1 -1
- package/dist/server/src/modules/transactions/resolvers/transactions.resolver.js +10 -0
- package/dist/server/src/modules/transactions/resolvers/transactions.resolver.js.map +1 -1
- package/dist/server/src/modules/transactions/typeDefs/transactions.graphql.js +1 -0
- package/dist/server/src/modules/transactions/typeDefs/transactions.graphql.js.map +1 -1
- package/package.json +1 -1
- package/src/__generated__/types.ts +92 -18
- package/src/modules/financial-entities/__generated__/admin-businesses.types.ts +60 -0
- package/src/modules/financial-entities/__generated__/types.ts +33 -10
- package/src/modules/financial-entities/helpers/admin-businesses.helper.ts +33 -0
- package/src/modules/financial-entities/providers/admin-businesses.provider.ts +44 -0
- package/src/modules/financial-entities/resolvers/admin-businesses.resolver.ts +53 -11
- package/src/modules/financial-entities/typeDefs/admin-businesses.graphql.ts +49 -16
- package/src/modules/financial-entities/types.ts +1 -1
- package/src/modules/ledger/__generated__/types.ts +3 -2
- package/src/modules/ledger/resolvers/ledger.resolver.ts +5 -0
- package/src/modules/ledger/typeDefs/ledger.graphql.ts +2 -0
- package/src/modules/transactions/__generated__/types.ts +2 -1
- package/src/modules/transactions/resolvers/transactions.resolver.ts +10 -0
- package/src/modules/transactions/typeDefs/transactions.graphql.ts +1 -0
|
@@ -148,11 +148,15 @@ export type AdminBusiness = {
|
|
|
148
148
|
readonly id: Scalars['UUID']['output'];
|
|
149
149
|
readonly name: Scalars['String']['output'];
|
|
150
150
|
readonly registrationDate: Scalars['TimelessDate']['output'];
|
|
151
|
-
|
|
152
|
-
readonly
|
|
153
|
-
readonly
|
|
154
|
-
|
|
155
|
-
readonly
|
|
151
|
+
/** Social Security Info */
|
|
152
|
+
readonly socialSecurityDeductionsId?: Maybe<Scalars['String']['output']>;
|
|
153
|
+
readonly socialSecurityEmployerIds: ReadonlyArray<AnnualId>;
|
|
154
|
+
/** Tax Advances Info */
|
|
155
|
+
readonly taxAdvancesAnnualIds: ReadonlyArray<AnnualId>;
|
|
156
|
+
readonly taxAdvancesRates: ReadonlyArray<TaxAdvancesRate>;
|
|
157
|
+
readonly withholdingTaxAnnualIds: ReadonlyArray<AnnualId>;
|
|
158
|
+
/** Withholding Tax Info */
|
|
159
|
+
readonly withholdingTaxCompanyId?: Maybe<Scalars['String']['output']>;
|
|
156
160
|
};
|
|
157
161
|
|
|
158
162
|
/** defines a tag / category for charge arrangement */
|
|
@@ -289,6 +293,19 @@ export type AdminContextInput = {
|
|
|
289
293
|
readonly zkufotIncomeTaxCategoryId?: InputMaybe<Scalars['UUID']['input']>;
|
|
290
294
|
};
|
|
291
295
|
|
|
296
|
+
/** Represents an annual identifier for tax purposes. */
|
|
297
|
+
export type AnnualId = {
|
|
298
|
+
readonly __typename?: 'AnnualId';
|
|
299
|
+
readonly id: Scalars['String']['output'];
|
|
300
|
+
readonly year: Scalars['Int']['output'];
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
/** Input type representing an annual identifier for tax purposes. */
|
|
304
|
+
export type AnnualIdInput = {
|
|
305
|
+
readonly id: Scalars['String']['input'];
|
|
306
|
+
readonly year: Scalars['Int']['input'];
|
|
307
|
+
};
|
|
308
|
+
|
|
292
309
|
/** Audit opinion type enum (חוות דעת) */
|
|
293
310
|
export type AuditOpinionType =
|
|
294
311
|
/** Adverse opinion (שלילית) */
|
|
@@ -1148,12 +1165,12 @@ export type Country = {
|
|
|
1148
1165
|
/** Input type for creating a new admin business. */
|
|
1149
1166
|
export type CreateAdminBusinessInput = {
|
|
1150
1167
|
readonly businessId: Scalars['UUID']['input'];
|
|
1168
|
+
readonly companyTaxId: Scalars['String']['input'];
|
|
1151
1169
|
readonly registrationDate: Scalars['TimelessDate']['input'];
|
|
1152
1170
|
readonly socialSecurityEmployerId?: InputMaybe<Scalars['String']['input']>;
|
|
1153
|
-
readonly
|
|
1171
|
+
readonly taxAdvancesAnnualId?: InputMaybe<Scalars['String']['input']>;
|
|
1154
1172
|
readonly taxAdvancesRate?: InputMaybe<Scalars['Float']['input']>;
|
|
1155
|
-
readonly
|
|
1156
|
-
readonly withholdingTaxFileNumber?: InputMaybe<Scalars['String']['input']>;
|
|
1173
|
+
readonly withholdingTaxAnnualId?: InputMaybe<Scalars['String']['input']>;
|
|
1157
1174
|
};
|
|
1158
1175
|
|
|
1159
1176
|
/** input for creating a new contract */
|
|
@@ -3554,6 +3571,7 @@ export type Query = {
|
|
|
3554
3571
|
readonly greenInvoiceClient: GreenInvoiceClient;
|
|
3555
3572
|
readonly incomeExpenseChart: IncomeExpenseChart;
|
|
3556
3573
|
readonly ledgerRecordsByDates: ReadonlyArray<LedgerRecord>;
|
|
3574
|
+
readonly ledgerRecordsByFinancialEntity: ReadonlyArray<LedgerRecord>;
|
|
3557
3575
|
readonly miscExpensesByCharge: ReadonlyArray<MiscExpense>;
|
|
3558
3576
|
readonly newDocumentInfoDraftByCharge: NewDocumentInfo;
|
|
3559
3577
|
readonly newDocumentInfoDraftByDocument: NewDocumentInfo;
|
|
@@ -3578,6 +3596,7 @@ export type Query = {
|
|
|
3578
3596
|
readonly taxCategory: TaxCategory;
|
|
3579
3597
|
readonly taxCategoryByBusinessId?: Maybe<TaxCategory>;
|
|
3580
3598
|
readonly taxReport: TaxReport;
|
|
3599
|
+
readonly transactionsByFinancialEntity: ReadonlyArray<Transaction>;
|
|
3581
3600
|
readonly transactionsByIDs: ReadonlyArray<Transaction>;
|
|
3582
3601
|
readonly transactionsForBalanceReport: ReadonlyArray<BalanceTransactions>;
|
|
3583
3602
|
readonly uniformFormat?: Maybe<UniformFormat>;
|
|
@@ -3794,6 +3813,12 @@ export type QueryLedgerRecordsByDatesArgs = {
|
|
|
3794
3813
|
};
|
|
3795
3814
|
|
|
3796
3815
|
|
|
3816
|
+
/** query root */
|
|
3817
|
+
export type QueryLedgerRecordsByFinancialEntityArgs = {
|
|
3818
|
+
financialEntityId: Scalars['UUID']['input'];
|
|
3819
|
+
};
|
|
3820
|
+
|
|
3821
|
+
|
|
3797
3822
|
/** query root */
|
|
3798
3823
|
export type QueryMiscExpensesByChargeArgs = {
|
|
3799
3824
|
chargeId: Scalars['UUID']['input'];
|
|
@@ -3937,6 +3962,12 @@ export type QueryTaxReportArgs = {
|
|
|
3937
3962
|
};
|
|
3938
3963
|
|
|
3939
3964
|
|
|
3965
|
+
/** query root */
|
|
3966
|
+
export type QueryTransactionsByFinancialEntityArgs = {
|
|
3967
|
+
financialEntityID: Scalars['UUID']['input'];
|
|
3968
|
+
};
|
|
3969
|
+
|
|
3970
|
+
|
|
3940
3971
|
/** query root */
|
|
3941
3972
|
export type QueryTransactionsByIDsArgs = {
|
|
3942
3973
|
transactionIDs: ReadonlyArray<Scalars['UUID']['input']>;
|
|
@@ -4359,6 +4390,19 @@ export type TagInput = {
|
|
|
4359
4390
|
readonly id: Scalars['String']['input'];
|
|
4360
4391
|
};
|
|
4361
4392
|
|
|
4393
|
+
/** Represents the tax advance rate for a specific date. */
|
|
4394
|
+
export type TaxAdvancesRate = {
|
|
4395
|
+
readonly __typename?: 'TaxAdvancesRate';
|
|
4396
|
+
readonly date: Scalars['TimelessDate']['output'];
|
|
4397
|
+
readonly rate: Scalars['Float']['output'];
|
|
4398
|
+
};
|
|
4399
|
+
|
|
4400
|
+
/** Input type representing the tax advance rate for a specific date. */
|
|
4401
|
+
export type TaxAdvancesRateInput = {
|
|
4402
|
+
readonly date: Scalars['TimelessDate']['input'];
|
|
4403
|
+
readonly rate: Scalars['Float']['input'];
|
|
4404
|
+
};
|
|
4405
|
+
|
|
4362
4406
|
/** Tax category entity used for ledger records */
|
|
4363
4407
|
export type TaxCategory = FinancialEntity & {
|
|
4364
4408
|
readonly __typename?: 'TaxCategory';
|
|
@@ -4483,12 +4527,17 @@ export type Unprocessed = Document & Linkable & {
|
|
|
4483
4527
|
|
|
4484
4528
|
/** Input type for updating admin business details. */
|
|
4485
4529
|
export type UpdateAdminBusinessInput = {
|
|
4530
|
+
readonly governmentId?: InputMaybe<Scalars['String']['input']>;
|
|
4531
|
+
readonly name?: InputMaybe<Scalars['String']['input']>;
|
|
4486
4532
|
readonly registrationDate?: InputMaybe<Scalars['TimelessDate']['input']>;
|
|
4487
|
-
|
|
4488
|
-
readonly
|
|
4489
|
-
|
|
4490
|
-
readonly
|
|
4491
|
-
readonly
|
|
4533
|
+
/** Social Security Info */
|
|
4534
|
+
readonly socialSecurityEmployerIds?: InputMaybe<ReadonlyArray<AnnualIdInput>>;
|
|
4535
|
+
/** Tax Advances Info */
|
|
4536
|
+
readonly taxAdvancesAnnualIds?: InputMaybe<ReadonlyArray<AnnualIdInput>>;
|
|
4537
|
+
readonly taxAdvancesRates?: InputMaybe<ReadonlyArray<TaxAdvancesRateInput>>;
|
|
4538
|
+
readonly withholdingTaxAnnualIds?: InputMaybe<ReadonlyArray<AnnualIdInput>>;
|
|
4539
|
+
/** Withholding Tax Info */
|
|
4540
|
+
readonly withholdingTaxCompanyId?: InputMaybe<Scalars['String']['input']>;
|
|
4492
4541
|
};
|
|
4493
4542
|
|
|
4494
4543
|
/** input for updateBusiness */
|
|
@@ -4986,6 +5035,8 @@ export type ResolversTypes = {
|
|
|
4986
5035
|
AdminBusiness: ResolverTypeWrapper<IGetAllAdminBusinessesResult>;
|
|
4987
5036
|
AdminContext: ResolverTypeWrapper<IGetAdminContextsResult>;
|
|
4988
5037
|
AdminContextInput: AdminContextInput;
|
|
5038
|
+
AnnualId: ResolverTypeWrapper<AnnualId>;
|
|
5039
|
+
AnnualIdInput: AnnualIdInput;
|
|
4989
5040
|
AuditOpinionType: AuditOpinionType;
|
|
4990
5041
|
BalanceTransactions: ResolverTypeWrapper<IGetNormalizedBalanceTransactionsResult>;
|
|
4991
5042
|
BankDeposit: ResolverTypeWrapper<Omit<BankDeposit, 'transactions'> & { transactions: ReadonlyArray<ResolversTypes['Transaction']> }>;
|
|
@@ -5202,6 +5253,8 @@ export type ResolversTypes = {
|
|
|
5202
5253
|
SuggestionsInput: SuggestionsInput;
|
|
5203
5254
|
Tag: ResolverTypeWrapper<IGetAllTagsResult>;
|
|
5204
5255
|
TagInput: TagInput;
|
|
5256
|
+
TaxAdvancesRate: ResolverTypeWrapper<TaxAdvancesRate>;
|
|
5257
|
+
TaxAdvancesRateInput: TaxAdvancesRateInput;
|
|
5205
5258
|
TaxCategory: ResolverTypeWrapper<IGetAllTaxCategoriesResult>;
|
|
5206
5259
|
TaxReport: ResolverTypeWrapper<Omit<TaxReport, 'reference' | 'report'> & { reference: ReadonlyArray<ResolversTypes['TaxReportYear']>, report: ResolversTypes['TaxReportYear'] }>;
|
|
5207
5260
|
TaxReportYear: ResolverTypeWrapper<TaxReportYearProto>;
|
|
@@ -5273,6 +5326,8 @@ export type ResolversParentTypes = {
|
|
|
5273
5326
|
AdminBusiness: IGetAllAdminBusinessesResult;
|
|
5274
5327
|
AdminContext: IGetAdminContextsResult;
|
|
5275
5328
|
AdminContextInput: AdminContextInput;
|
|
5329
|
+
AnnualId: AnnualId;
|
|
5330
|
+
AnnualIdInput: AnnualIdInput;
|
|
5276
5331
|
BalanceTransactions: IGetNormalizedBalanceTransactionsResult;
|
|
5277
5332
|
BankDeposit: Omit<BankDeposit, 'transactions'> & { transactions: ReadonlyArray<ResolversParentTypes['Transaction']> };
|
|
5278
5333
|
BankDepositCharge: IGetChargesByIdsResult;
|
|
@@ -5454,6 +5509,8 @@ export type ResolversParentTypes = {
|
|
|
5454
5509
|
SuggestionsInput: SuggestionsInput;
|
|
5455
5510
|
Tag: IGetAllTagsResult;
|
|
5456
5511
|
TagInput: TagInput;
|
|
5512
|
+
TaxAdvancesRate: TaxAdvancesRate;
|
|
5513
|
+
TaxAdvancesRateInput: TaxAdvancesRateInput;
|
|
5457
5514
|
TaxCategory: IGetAllTaxCategoriesResult;
|
|
5458
5515
|
TaxReport: Omit<TaxReport, 'reference' | 'report'> & { reference: ReadonlyArray<ResolversParentTypes['TaxReportYear']>, report: ResolversParentTypes['TaxReportYear'] };
|
|
5459
5516
|
TaxReportYear: TaxReportYearProto;
|
|
@@ -5534,11 +5591,12 @@ export type AdminBusinessResolvers<ContextType = GraphQLModules.Context, ParentT
|
|
|
5534
5591
|
id?: Resolver<ResolversTypes['UUID'], ParentType, ContextType>;
|
|
5535
5592
|
name?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
|
|
5536
5593
|
registrationDate?: Resolver<ResolversTypes['TimelessDate'], ParentType, ContextType>;
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
|
|
5594
|
+
socialSecurityDeductionsId?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
|
|
5595
|
+
socialSecurityEmployerIds?: Resolver<ReadonlyArray<ResolversTypes['AnnualId']>, ParentType, ContextType>;
|
|
5596
|
+
taxAdvancesAnnualIds?: Resolver<ReadonlyArray<ResolversTypes['AnnualId']>, ParentType, ContextType>;
|
|
5597
|
+
taxAdvancesRates?: Resolver<ReadonlyArray<ResolversTypes['TaxAdvancesRate']>, ParentType, ContextType>;
|
|
5598
|
+
withholdingTaxAnnualIds?: Resolver<ReadonlyArray<ResolversTypes['AnnualId']>, ParentType, ContextType>;
|
|
5599
|
+
withholdingTaxCompanyId?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
|
|
5542
5600
|
__isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
|
|
5543
5601
|
};
|
|
5544
5602
|
|
|
@@ -5609,6 +5667,12 @@ export type AdminContextResolvers<ContextType = GraphQLModules.Context, ParentTy
|
|
|
5609
5667
|
__isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
|
|
5610
5668
|
};
|
|
5611
5669
|
|
|
5670
|
+
export type AnnualIdResolvers<ContextType = GraphQLModules.Context, ParentType extends ResolversParentTypes['AnnualId'] = ResolversParentTypes['AnnualId']> = {
|
|
5671
|
+
id?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
|
|
5672
|
+
year?: Resolver<ResolversTypes['Int'], ParentType, ContextType>;
|
|
5673
|
+
__isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
|
|
5674
|
+
};
|
|
5675
|
+
|
|
5612
5676
|
export type BalanceTransactionsResolvers<ContextType = GraphQLModules.Context, ParentType extends ResolversParentTypes['BalanceTransactions'] = ResolversParentTypes['BalanceTransactions']> = {
|
|
5613
5677
|
amount?: Resolver<ResolversTypes['FinancialAmount'], ParentType, ContextType>;
|
|
5614
5678
|
amountUsd?: Resolver<ResolversTypes['FinancialAmount'], ParentType, ContextType>;
|
|
@@ -7254,6 +7318,7 @@ export type QueryResolvers<ContextType = GraphQLModules.Context, ParentType exte
|
|
|
7254
7318
|
greenInvoiceClient?: Resolver<ResolversTypes['GreenInvoiceClient'], ParentType, ContextType, RequireFields<QueryGreenInvoiceClientArgs, 'clientId'>>;
|
|
7255
7319
|
incomeExpenseChart?: Resolver<ResolversTypes['IncomeExpenseChart'], ParentType, ContextType, RequireFields<QueryIncomeExpenseChartArgs, 'filters'>>;
|
|
7256
7320
|
ledgerRecordsByDates?: Resolver<ReadonlyArray<ResolversTypes['LedgerRecord']>, ParentType, ContextType, RequireFields<QueryLedgerRecordsByDatesArgs, 'fromDate' | 'toDate'>>;
|
|
7321
|
+
ledgerRecordsByFinancialEntity?: Resolver<ReadonlyArray<ResolversTypes['LedgerRecord']>, ParentType, ContextType, RequireFields<QueryLedgerRecordsByFinancialEntityArgs, 'financialEntityId'>>;
|
|
7257
7322
|
miscExpensesByCharge?: Resolver<ReadonlyArray<ResolversTypes['MiscExpense']>, ParentType, ContextType, RequireFields<QueryMiscExpensesByChargeArgs, 'chargeId'>>;
|
|
7258
7323
|
newDocumentInfoDraftByCharge?: Resolver<ResolversTypes['NewDocumentInfo'], ParentType, ContextType, RequireFields<QueryNewDocumentInfoDraftByChargeArgs, 'chargeId'>>;
|
|
7259
7324
|
newDocumentInfoDraftByDocument?: Resolver<ResolversTypes['NewDocumentInfo'], ParentType, ContextType, RequireFields<QueryNewDocumentInfoDraftByDocumentArgs, 'documentId'>>;
|
|
@@ -7276,6 +7341,7 @@ export type QueryResolvers<ContextType = GraphQLModules.Context, ParentType exte
|
|
|
7276
7341
|
taxCategory?: Resolver<ResolversTypes['TaxCategory'], ParentType, ContextType, RequireFields<QueryTaxCategoryArgs, 'id'>>;
|
|
7277
7342
|
taxCategoryByBusinessId?: Resolver<Maybe<ResolversTypes['TaxCategory']>, ParentType, ContextType, RequireFields<QueryTaxCategoryByBusinessIdArgs, 'businessId' | 'ownerId'>>;
|
|
7278
7343
|
taxReport?: Resolver<ResolversTypes['TaxReport'], ParentType, ContextType, RequireFields<QueryTaxReportArgs, 'referenceYears' | 'reportYear'>>;
|
|
7344
|
+
transactionsByFinancialEntity?: Resolver<ReadonlyArray<ResolversTypes['Transaction']>, ParentType, ContextType, RequireFields<QueryTransactionsByFinancialEntityArgs, 'financialEntityID'>>;
|
|
7279
7345
|
transactionsByIDs?: Resolver<ReadonlyArray<ResolversTypes['Transaction']>, ParentType, ContextType, RequireFields<QueryTransactionsByIDsArgs, 'transactionIDs'>>;
|
|
7280
7346
|
transactionsForBalanceReport?: Resolver<ReadonlyArray<ResolversTypes['BalanceTransactions']>, ParentType, ContextType, RequireFields<QueryTransactionsForBalanceReportArgs, 'fromDate' | 'toDate'>>;
|
|
7281
7347
|
uniformFormat?: Resolver<Maybe<ResolversTypes['UniformFormat']>, ParentType, ContextType, RequireFields<QueryUniformFormatArgs, 'fromDate' | 'toDate'>>;
|
|
@@ -7514,6 +7580,12 @@ export type TagResolvers<ContextType = GraphQLModules.Context, ParentType extend
|
|
|
7514
7580
|
__isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
|
|
7515
7581
|
};
|
|
7516
7582
|
|
|
7583
|
+
export type TaxAdvancesRateResolvers<ContextType = GraphQLModules.Context, ParentType extends ResolversParentTypes['TaxAdvancesRate'] = ResolversParentTypes['TaxAdvancesRate']> = {
|
|
7584
|
+
date?: Resolver<ResolversTypes['TimelessDate'], ParentType, ContextType>;
|
|
7585
|
+
rate?: Resolver<ResolversTypes['Float'], ParentType, ContextType>;
|
|
7586
|
+
__isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
|
|
7587
|
+
};
|
|
7588
|
+
|
|
7517
7589
|
export type TaxCategoryResolvers<ContextType = GraphQLModules.Context, ParentType extends ResolversParentTypes['TaxCategory'] = ResolversParentTypes['TaxCategory']> = {
|
|
7518
7590
|
createdAt?: Resolver<ResolversTypes['DateTime'], ParentType, ContextType>;
|
|
7519
7591
|
id?: Resolver<ResolversTypes['UUID'], ParentType, ContextType>;
|
|
@@ -7782,6 +7854,7 @@ export type YearlyLedgerReportFinancialEntityInfoResolvers<ContextType = GraphQL
|
|
|
7782
7854
|
export type Resolvers<ContextType = GraphQLModules.Context> = {
|
|
7783
7855
|
AdminBusiness?: AdminBusinessResolvers<ContextType>;
|
|
7784
7856
|
AdminContext?: AdminContextResolvers<ContextType>;
|
|
7857
|
+
AnnualId?: AnnualIdResolvers<ContextType>;
|
|
7785
7858
|
BalanceTransactions?: BalanceTransactionsResolvers<ContextType>;
|
|
7786
7859
|
BankDeposit?: BankDepositResolvers<ContextType>;
|
|
7787
7860
|
BankDepositCharge?: BankDepositChargeResolvers<ContextType>;
|
|
@@ -7927,6 +8000,7 @@ export type Resolvers<ContextType = GraphQLModules.Context> = {
|
|
|
7927
8000
|
Suggestions?: SuggestionsResolvers<ContextType>;
|
|
7928
8001
|
SuggestionsEmailListenerConfig?: SuggestionsEmailListenerConfigResolvers<ContextType>;
|
|
7929
8002
|
Tag?: TagResolvers<ContextType>;
|
|
8003
|
+
TaxAdvancesRate?: TaxAdvancesRateResolvers<ContextType>;
|
|
7930
8004
|
TaxCategory?: TaxCategoryResolvers<ContextType>;
|
|
7931
8005
|
TaxReport?: TaxReportResolvers<ContextType>;
|
|
7932
8006
|
TaxReportYear?: TaxReportYearResolvers<ContextType>;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
/** Types generated for queries found in "src/modules/financial-entities/providers/admin-businesses.provider.ts" */
|
|
2
|
+
export type DateOrString = Date | string;
|
|
3
|
+
|
|
4
|
+
export type Json = null | boolean | number | string | Json[] | { [key: string]: Json };
|
|
5
|
+
|
|
6
|
+
export type JsonArray = (Json)[];
|
|
2
7
|
|
|
3
8
|
/** 'GetAdminBusinessesByIds' parameters type */
|
|
4
9
|
export interface IGetAdminBusinessesByIdsParams {
|
|
@@ -8,6 +13,9 @@ export interface IGetAdminBusinessesByIdsParams {
|
|
|
8
13
|
/** 'GetAdminBusinessesByIds' return type */
|
|
9
14
|
export interface IGetAdminBusinessesByIdsResult {
|
|
10
15
|
advance_tax_rate: number | null;
|
|
16
|
+
advance_tax_rates: JsonArray;
|
|
17
|
+
business_registration_start_date: Date | null;
|
|
18
|
+
company_tax_id: string | null;
|
|
11
19
|
id: string;
|
|
12
20
|
name: string;
|
|
13
21
|
nikuim: string | null;
|
|
@@ -15,6 +23,8 @@ export interface IGetAdminBusinessesByIdsResult {
|
|
|
15
23
|
pinkas_social_security_2021: string | null;
|
|
16
24
|
pinkas_social_security_2022: string | null;
|
|
17
25
|
registration_date: Date | null;
|
|
26
|
+
social_security_employer_ids: JsonArray;
|
|
27
|
+
tax_advances_ids: JsonArray;
|
|
18
28
|
tax_nikuim_pinkas_number: string | null;
|
|
19
29
|
tax_pinkas_number_2020: string | null;
|
|
20
30
|
tax_siduri_number_2021: string | null;
|
|
@@ -23,6 +33,7 @@ export interface IGetAdminBusinessesByIdsResult {
|
|
|
23
33
|
vat_number: string | null;
|
|
24
34
|
vat_report_cadence: number | null;
|
|
25
35
|
website_login_screenshot: string | null;
|
|
36
|
+
withholding_tax_annual_ids: JsonArray;
|
|
26
37
|
wizcloud_company_id: string | null;
|
|
27
38
|
wizcloud_token: string | null;
|
|
28
39
|
}
|
|
@@ -39,6 +50,9 @@ export type IGetAllAdminBusinessesParams = void;
|
|
|
39
50
|
/** 'GetAllAdminBusinesses' return type */
|
|
40
51
|
export interface IGetAllAdminBusinessesResult {
|
|
41
52
|
advance_tax_rate: number | null;
|
|
53
|
+
advance_tax_rates: JsonArray;
|
|
54
|
+
business_registration_start_date: Date | null;
|
|
55
|
+
company_tax_id: string | null;
|
|
42
56
|
id: string;
|
|
43
57
|
name: string;
|
|
44
58
|
nikuim: string | null;
|
|
@@ -46,6 +60,8 @@ export interface IGetAllAdminBusinessesResult {
|
|
|
46
60
|
pinkas_social_security_2021: string | null;
|
|
47
61
|
pinkas_social_security_2022: string | null;
|
|
48
62
|
registration_date: Date | null;
|
|
63
|
+
social_security_employer_ids: JsonArray;
|
|
64
|
+
tax_advances_ids: JsonArray;
|
|
49
65
|
tax_nikuim_pinkas_number: string | null;
|
|
50
66
|
tax_pinkas_number_2020: string | null;
|
|
51
67
|
tax_siduri_number_2021: string | null;
|
|
@@ -54,6 +70,7 @@ export interface IGetAllAdminBusinessesResult {
|
|
|
54
70
|
vat_number: string | null;
|
|
55
71
|
vat_report_cadence: number | null;
|
|
56
72
|
website_login_screenshot: string | null;
|
|
73
|
+
withholding_tax_annual_ids: JsonArray;
|
|
57
74
|
wizcloud_company_id: string | null;
|
|
58
75
|
wizcloud_token: string | null;
|
|
59
76
|
}
|
|
@@ -64,3 +81,46 @@ export interface IGetAllAdminBusinessesQuery {
|
|
|
64
81
|
result: IGetAllAdminBusinessesResult;
|
|
65
82
|
}
|
|
66
83
|
|
|
84
|
+
/** 'UpdateAdminBusinesses' parameters type */
|
|
85
|
+
export interface IUpdateAdminBusinessesParams {
|
|
86
|
+
advanceTaxRates?: JsonArray | null | void;
|
|
87
|
+
businessRegistrationStartDate?: DateOrString | null | void;
|
|
88
|
+
companyTaxId?: string | null | void;
|
|
89
|
+
id?: string | null | void;
|
|
90
|
+
socialSecurityEmployerIds?: JsonArray | null | void;
|
|
91
|
+
taxAdvancesIds?: JsonArray | null | void;
|
|
92
|
+
withholdingTaxAnnualIds?: JsonArray | null | void;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** 'UpdateAdminBusinesses' return type */
|
|
96
|
+
export interface IUpdateAdminBusinessesResult {
|
|
97
|
+
advance_tax_rate: number | null;
|
|
98
|
+
advance_tax_rates: JsonArray;
|
|
99
|
+
business_registration_start_date: Date | null;
|
|
100
|
+
company_tax_id: string | null;
|
|
101
|
+
id: string;
|
|
102
|
+
nikuim: string | null;
|
|
103
|
+
password: string | null;
|
|
104
|
+
pinkas_social_security_2021: string | null;
|
|
105
|
+
pinkas_social_security_2022: string | null;
|
|
106
|
+
registration_date: Date | null;
|
|
107
|
+
social_security_employer_ids: JsonArray;
|
|
108
|
+
tax_advances_ids: JsonArray;
|
|
109
|
+
tax_nikuim_pinkas_number: string | null;
|
|
110
|
+
tax_pinkas_number_2020: string | null;
|
|
111
|
+
tax_siduri_number_2021: string | null;
|
|
112
|
+
tax_siduri_number_2022: string | null;
|
|
113
|
+
username_vat_website: string | null;
|
|
114
|
+
vat_report_cadence: number | null;
|
|
115
|
+
website_login_screenshot: string | null;
|
|
116
|
+
withholding_tax_annual_ids: JsonArray;
|
|
117
|
+
wizcloud_company_id: string | null;
|
|
118
|
+
wizcloud_token: string | null;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** 'UpdateAdminBusinesses' query type */
|
|
122
|
+
export interface IUpdateAdminBusinessesQuery {
|
|
123
|
+
params: IUpdateAdminBusinessesParams;
|
|
124
|
+
result: IUpdateAdminBusinessesResult;
|
|
125
|
+
}
|
|
126
|
+
|
|
@@ -4,7 +4,9 @@ export namespace FinancialEntitiesModule {
|
|
|
4
4
|
interface DefinedFields {
|
|
5
5
|
Query: 'adminBusiness' | 'allAdminBusinesses' | 'businessTransactionsSumFromLedgerRecords' | 'businessTransactionsFromLedgerRecords' | 'business' | 'businesses' | 'allBusinesses' | 'client' | 'allClients' | 'financialEntity' | 'allFinancialEntities' | 'taxCategories' | 'taxCategory' | 'taxCategoryByBusinessId';
|
|
6
6
|
Mutation: 'createAdminBusiness' | 'updateAdminBusiness' | 'deleteAdminBusiness' | 'updateBusiness' | 'insertNewBusiness' | 'mergeBusinesses' | 'batchGenerateBusinessesOutOfTransactions' | 'updateClient' | 'insertClient' | 'updateTaxCategory' | 'insertTaxCategory';
|
|
7
|
-
AdminBusiness: 'id' | 'name' | 'governmentId' | 'business' | '
|
|
7
|
+
AdminBusiness: 'id' | 'name' | 'governmentId' | 'registrationDate' | 'business' | 'taxAdvancesAnnualIds' | 'taxAdvancesRates' | 'withholdingTaxCompanyId' | 'withholdingTaxAnnualIds' | 'socialSecurityDeductionsId' | 'socialSecurityEmployerIds';
|
|
8
|
+
AnnualId: 'year' | 'id';
|
|
9
|
+
TaxAdvancesRate: 'date' | 'rate';
|
|
8
10
|
BusinessTransactionsSumFromLedgerRecordsSuccessfulResult: 'businessTransactionsSum';
|
|
9
11
|
BusinessTransactionSum: 'business' | 'credit' | 'debit' | 'total' | 'foreignCurrenciesSum';
|
|
10
12
|
ForeignCurrencySum: 'credit' | 'debit' | 'total' | 'currency';
|
|
@@ -50,8 +52,10 @@ export namespace FinancialEntitiesModule {
|
|
|
50
52
|
};
|
|
51
53
|
|
|
52
54
|
interface DefinedInputFields {
|
|
53
|
-
CreateAdminBusinessInput: 'businessId' | '
|
|
54
|
-
UpdateAdminBusinessInput: '
|
|
55
|
+
CreateAdminBusinessInput: 'businessId' | 'registrationDate' | 'companyTaxId' | 'taxAdvancesAnnualId' | 'taxAdvancesRate' | 'withholdingTaxAnnualId' | 'socialSecurityEmployerId';
|
|
56
|
+
UpdateAdminBusinessInput: 'name' | 'governmentId' | 'registrationDate' | 'taxAdvancesAnnualIds' | 'taxAdvancesRates' | 'withholdingTaxCompanyId' | 'withholdingTaxAnnualIds' | 'socialSecurityEmployerIds';
|
|
57
|
+
AnnualIdInput: 'year' | 'id';
|
|
58
|
+
TaxAdvancesRateInput: 'date' | 'rate';
|
|
55
59
|
BusinessTransactionsFilter: 'businessIDs' | 'ownerIds' | 'type' | 'fromDate' | 'toDate' | 'includeRevaluation';
|
|
56
60
|
UpdateBusinessInput: 'name' | 'sortCode' | 'country' | 'hebrewName' | 'address' | 'email' | 'website' | 'phoneNumber' | 'governmentId' | 'taxCategory' | 'exemptDealer' | 'suggestions' | 'optionalVAT' | 'isReceiptEnough' | 'isDocumentsOptional' | 'pcn874RecordType' | 'irsCode' | 'isActive';
|
|
57
61
|
InsertNewBusinessInput: 'name' | 'sortCode' | 'country' | 'hebrewName' | 'address' | 'email' | 'website' | 'phoneNumber' | 'governmentId' | 'taxCategory' | 'exemptDealer' | 'suggestions' | 'optionalVAT' | 'isReceiptEnough' | 'isDocumentsOptional' | 'pcn874RecordType' | 'irsCode' | 'isActive';
|
|
@@ -70,8 +74,12 @@ export namespace FinancialEntitiesModule {
|
|
|
70
74
|
export type Mutation = Pick<Types.Mutation, DefinedFields['Mutation']>;
|
|
71
75
|
export type CreateAdminBusinessInput = Pick<Types.CreateAdminBusinessInput, DefinedInputFields['CreateAdminBusinessInput']>;
|
|
72
76
|
export type UpdateAdminBusinessInput = Pick<Types.UpdateAdminBusinessInput, DefinedInputFields['UpdateAdminBusinessInput']>;
|
|
73
|
-
export type LtdFinancialEntity = Pick<Types.LtdFinancialEntity, DefinedFields['LtdFinancialEntity']>;
|
|
74
77
|
export type TimelessDate = Types.TimelessDate;
|
|
78
|
+
export type LtdFinancialEntity = Pick<Types.LtdFinancialEntity, DefinedFields['LtdFinancialEntity']>;
|
|
79
|
+
export type AnnualId = Pick<Types.AnnualId, DefinedFields['AnnualId']>;
|
|
80
|
+
export type TaxAdvancesRate = Pick<Types.TaxAdvancesRate, DefinedFields['TaxAdvancesRate']>;
|
|
81
|
+
export type AnnualIdInput = Pick<Types.AnnualIdInput, DefinedInputFields['AnnualIdInput']>;
|
|
82
|
+
export type TaxAdvancesRateInput = Pick<Types.TaxAdvancesRateInput, DefinedInputFields['TaxAdvancesRateInput']>;
|
|
75
83
|
export type BusinessTransactionsSumFromLedgerRecordsResult = Types.BusinessTransactionsSumFromLedgerRecordsResult;
|
|
76
84
|
export type BusinessTransactionsFilter = Pick<Types.BusinessTransactionsFilter, DefinedInputFields['BusinessTransactionsFilter']>;
|
|
77
85
|
export type BusinessTransactionsFromLedgerRecordsResult = Types.BusinessTransactionsFromLedgerRecordsResult;
|
|
@@ -139,6 +147,8 @@ export namespace FinancialEntitiesModule {
|
|
|
139
147
|
export type QueryResolvers = Pick<Types.QueryResolvers, DefinedFields['Query']>;
|
|
140
148
|
export type MutationResolvers = Pick<Types.MutationResolvers, DefinedFields['Mutation']>;
|
|
141
149
|
export type AdminBusinessResolvers = Pick<Types.AdminBusinessResolvers, DefinedFields['AdminBusiness']>;
|
|
150
|
+
export type AnnualIdResolvers = Pick<Types.AnnualIdResolvers, DefinedFields['AnnualId']>;
|
|
151
|
+
export type TaxAdvancesRateResolvers = Pick<Types.TaxAdvancesRateResolvers, DefinedFields['TaxAdvancesRate']>;
|
|
142
152
|
export type BusinessTransactionsSumFromLedgerRecordsSuccessfulResultResolvers = Pick<Types.BusinessTransactionsSumFromLedgerRecordsSuccessfulResultResolvers, DefinedFields['BusinessTransactionsSumFromLedgerRecordsSuccessfulResult'] | '__isTypeOf'>;
|
|
143
153
|
export type BusinessTransactionSumResolvers = Pick<Types.BusinessTransactionSumResolvers, DefinedFields['BusinessTransactionSum']>;
|
|
144
154
|
export type ForeignCurrencySumResolvers = Pick<Types.ForeignCurrencySumResolvers, DefinedFields['ForeignCurrencySum']>;
|
|
@@ -181,6 +191,8 @@ export namespace FinancialEntitiesModule {
|
|
|
181
191
|
Query?: QueryResolvers;
|
|
182
192
|
Mutation?: MutationResolvers;
|
|
183
193
|
AdminBusiness?: AdminBusinessResolvers;
|
|
194
|
+
AnnualId?: AnnualIdResolvers;
|
|
195
|
+
TaxAdvancesRate?: TaxAdvancesRateResolvers;
|
|
184
196
|
BusinessTransactionsSumFromLedgerRecordsSuccessfulResult?: BusinessTransactionsSumFromLedgerRecordsSuccessfulResultResolvers;
|
|
185
197
|
BusinessTransactionSum?: BusinessTransactionSumResolvers;
|
|
186
198
|
ForeignCurrencySum?: ForeignCurrencySumResolvers;
|
|
@@ -255,13 +267,24 @@ export namespace FinancialEntitiesModule {
|
|
|
255
267
|
id?: gm.Middleware[];
|
|
256
268
|
name?: gm.Middleware[];
|
|
257
269
|
governmentId?: gm.Middleware[];
|
|
258
|
-
business?: gm.Middleware[];
|
|
259
|
-
withholdingTaxBookNumber?: gm.Middleware[];
|
|
260
|
-
withholdingTaxFileNumber?: gm.Middleware[];
|
|
261
|
-
socialSecurityEmployerId?: gm.Middleware[];
|
|
262
|
-
taxAdvancesRate?: gm.Middleware[];
|
|
263
|
-
taxAdvancesId?: gm.Middleware[];
|
|
264
270
|
registrationDate?: gm.Middleware[];
|
|
271
|
+
business?: gm.Middleware[];
|
|
272
|
+
taxAdvancesAnnualIds?: gm.Middleware[];
|
|
273
|
+
taxAdvancesRates?: gm.Middleware[];
|
|
274
|
+
withholdingTaxCompanyId?: gm.Middleware[];
|
|
275
|
+
withholdingTaxAnnualIds?: gm.Middleware[];
|
|
276
|
+
socialSecurityDeductionsId?: gm.Middleware[];
|
|
277
|
+
socialSecurityEmployerIds?: gm.Middleware[];
|
|
278
|
+
};
|
|
279
|
+
AnnualId?: {
|
|
280
|
+
'*'?: gm.Middleware[];
|
|
281
|
+
year?: gm.Middleware[];
|
|
282
|
+
id?: gm.Middleware[];
|
|
283
|
+
};
|
|
284
|
+
TaxAdvancesRate?: {
|
|
285
|
+
'*'?: gm.Middleware[];
|
|
286
|
+
date?: gm.Middleware[];
|
|
287
|
+
rate?: gm.Middleware[];
|
|
265
288
|
};
|
|
266
289
|
LtdFinancialEntity?: {
|
|
267
290
|
'*'?: gm.Middleware[];
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
const yearlyIdSchema = z
|
|
4
|
+
.object({
|
|
5
|
+
year: z.number().min(2000).max(2100),
|
|
6
|
+
id: z.string().min(1, { message: 'ID is required' }),
|
|
7
|
+
})
|
|
8
|
+
.strict();
|
|
9
|
+
|
|
10
|
+
const taxAdvanceRateSchema = z
|
|
11
|
+
.object({
|
|
12
|
+
date: z.iso.date(),
|
|
13
|
+
rate: z.number().min(0).max(1),
|
|
14
|
+
})
|
|
15
|
+
.strict();
|
|
16
|
+
|
|
17
|
+
export const adminBusinessUpdateSchema = z
|
|
18
|
+
.object({
|
|
19
|
+
id: z.uuid(),
|
|
20
|
+
businessRegistrationStartDate: z.iso.date().optional(),
|
|
21
|
+
companyTaxId: z.string().optional(),
|
|
22
|
+
advanceTaxRates: z.array(taxAdvanceRateSchema).optional(),
|
|
23
|
+
taxAdvancesIds: z.array(yearlyIdSchema).optional(),
|
|
24
|
+
socialSecurityEmployerIds: z.array(yearlyIdSchema).optional(),
|
|
25
|
+
withholdingTaxAnnualIds: z.array(yearlyIdSchema).optional(),
|
|
26
|
+
})
|
|
27
|
+
.strict();
|
|
28
|
+
|
|
29
|
+
export type AdminBusinessUpdateSchema = z.infer<typeof adminBusinessUpdateSchema>;
|
|
30
|
+
|
|
31
|
+
export const yearlyIdsSchema = z.array(yearlyIdSchema);
|
|
32
|
+
|
|
33
|
+
export const taxAdvancesRatesSchema = z.array(taxAdvanceRateSchema);
|
|
@@ -3,10 +3,14 @@ import { Injectable, Scope } from 'graphql-modules';
|
|
|
3
3
|
import { DBProvider } from '@modules/app-providers/db.provider.js';
|
|
4
4
|
import { sql } from '@pgtyped/runtime';
|
|
5
5
|
import { getCacheInstance } from '@shared/helpers';
|
|
6
|
+
import { adminBusinessUpdateSchema } from '../helpers/admin-businesses.helper.js';
|
|
6
7
|
import type {
|
|
7
8
|
IGetAdminBusinessesByIdsQuery,
|
|
8
9
|
IGetAllAdminBusinessesQuery,
|
|
9
10
|
IGetAllAdminBusinessesResult,
|
|
11
|
+
IUpdateAdminBusinessesParams,
|
|
12
|
+
IUpdateAdminBusinessesQuery,
|
|
13
|
+
IUpdateAdminBusinessesResult,
|
|
10
14
|
} from '../types.js';
|
|
11
15
|
|
|
12
16
|
const getAdminBusinessesByIds = sql<IGetAdminBusinessesByIdsQuery>`
|
|
@@ -28,6 +32,37 @@ const getAllAdminBusinesses = sql<IGetAllAdminBusinessesQuery>`
|
|
|
28
32
|
INNER JOIN accounter_schema.financial_entities fe
|
|
29
33
|
USING (id);`;
|
|
30
34
|
|
|
35
|
+
const updateAdminBusinesses = sql<IUpdateAdminBusinessesQuery>`
|
|
36
|
+
UPDATE accounter_schema.businesses_admin
|
|
37
|
+
SET
|
|
38
|
+
business_registration_start_date = COALESCE(
|
|
39
|
+
$businessRegistrationStartDate,
|
|
40
|
+
business_registration_start_date
|
|
41
|
+
),
|
|
42
|
+
company_tax_id = COALESCE(
|
|
43
|
+
$companyTaxId,
|
|
44
|
+
company_tax_id
|
|
45
|
+
),
|
|
46
|
+
advance_tax_rates = COALESCE(
|
|
47
|
+
$advanceTaxRates,
|
|
48
|
+
advance_tax_rates
|
|
49
|
+
),
|
|
50
|
+
tax_advances_ids = COALESCE(
|
|
51
|
+
$taxAdvancesIds,
|
|
52
|
+
tax_advances_ids
|
|
53
|
+
),
|
|
54
|
+
social_security_employer_ids = COALESCE(
|
|
55
|
+
$socialSecurityEmployerIds,
|
|
56
|
+
social_security_employer_ids
|
|
57
|
+
),
|
|
58
|
+
withholding_tax_annual_ids = COALESCE(
|
|
59
|
+
$withholdingTaxAnnualIds,
|
|
60
|
+
withholding_tax_annual_ids
|
|
61
|
+
)
|
|
62
|
+
WHERE
|
|
63
|
+
id = $id
|
|
64
|
+
RETURNING *;`;
|
|
65
|
+
|
|
31
66
|
@Injectable({
|
|
32
67
|
scope: Scope.Operation,
|
|
33
68
|
global: true,
|
|
@@ -69,6 +104,15 @@ export class AdminBusinessesProvider {
|
|
|
69
104
|
});
|
|
70
105
|
}
|
|
71
106
|
|
|
107
|
+
public async updateAdminBusiness(
|
|
108
|
+
params: IUpdateAdminBusinessesParams,
|
|
109
|
+
): Promise<IUpdateAdminBusinessesResult> {
|
|
110
|
+
const inputParams = adminBusinessUpdateSchema.parse(params);
|
|
111
|
+
const [result] = await updateAdminBusinesses.run(inputParams, this.dbProvider);
|
|
112
|
+
this.clearCache();
|
|
113
|
+
return result;
|
|
114
|
+
}
|
|
115
|
+
|
|
72
116
|
public clearCache() {
|
|
73
117
|
this.cache.clear();
|
|
74
118
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { GraphQLError } from 'graphql';
|
|
2
2
|
import { dateToTimelessDateString } from '@shared/helpers';
|
|
3
|
+
import { TimelessDateString } from '@shared/types';
|
|
4
|
+
import { taxAdvancesRatesSchema, yearlyIdsSchema } from '../helpers/admin-businesses.helper.js';
|
|
3
5
|
import { AdminBusinessesProvider } from '../providers/admin-businesses.provider.js';
|
|
4
6
|
import { BusinessesProvider } from '../providers/businesses.provider.js';
|
|
5
7
|
import type { FinancialEntitiesModule } from '../types.js';
|
|
@@ -22,6 +24,41 @@ export const adminBusinessesResolvers: FinancialEntitiesModule.Resolvers = {
|
|
|
22
24
|
return adminBusinesses;
|
|
23
25
|
},
|
|
24
26
|
},
|
|
27
|
+
Mutation: {
|
|
28
|
+
updateAdminBusiness: async (_, { businessId, fields }, { injector }) => {
|
|
29
|
+
try {
|
|
30
|
+
await injector.get(AdminBusinessesProvider).updateAdminBusiness({
|
|
31
|
+
id: businessId,
|
|
32
|
+
businessRegistrationStartDate: fields.registrationDate,
|
|
33
|
+
companyTaxId: fields.withholdingTaxCompanyId,
|
|
34
|
+
taxAdvancesIds: fields.taxAdvancesAnnualIds
|
|
35
|
+
? [...fields.taxAdvancesAnnualIds]
|
|
36
|
+
: undefined,
|
|
37
|
+
advanceTaxRates: fields.taxAdvancesRates ? [...fields.taxAdvancesRates] : undefined,
|
|
38
|
+
withholdingTaxAnnualIds: fields.withholdingTaxAnnualIds
|
|
39
|
+
? [...fields.withholdingTaxAnnualIds]
|
|
40
|
+
: undefined,
|
|
41
|
+
socialSecurityEmployerIds: fields.socialSecurityEmployerIds
|
|
42
|
+
? [...fields.socialSecurityEmployerIds]
|
|
43
|
+
: undefined,
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const updatedAdminBusiness = await injector
|
|
47
|
+
.get(AdminBusinessesProvider)
|
|
48
|
+
.getAdminBusinessByIdLoader.load(businessId);
|
|
49
|
+
|
|
50
|
+
if (!updatedAdminBusiness) {
|
|
51
|
+
throw new GraphQLError(`Error updating Admin business ID="${businessId}"`);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return updatedAdminBusiness;
|
|
55
|
+
} catch (error) {
|
|
56
|
+
const message = `Error updating Admin business ID="${businessId}"`;
|
|
57
|
+
console.error(message, error);
|
|
58
|
+
throw new GraphQLError(message);
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
},
|
|
25
62
|
AdminBusiness: {
|
|
26
63
|
id: admin => admin.id,
|
|
27
64
|
name: admin => admin.name,
|
|
@@ -31,6 +68,12 @@ export const adminBusinessesResolvers: FinancialEntitiesModule.Resolvers = {
|
|
|
31
68
|
}
|
|
32
69
|
return admin.vat_number;
|
|
33
70
|
},
|
|
71
|
+
registrationDate: admin => {
|
|
72
|
+
if (!admin.registration_date) {
|
|
73
|
+
throw new GraphQLError(`Admin business ID="${admin.id}" has no registration date`);
|
|
74
|
+
}
|
|
75
|
+
return dateToTimelessDateString(admin.registration_date);
|
|
76
|
+
},
|
|
34
77
|
business: async (admin, _, { injector }) => {
|
|
35
78
|
const business = await injector.get(BusinessesProvider).getBusinessByIdLoader.load(admin.id);
|
|
36
79
|
if (!business) {
|
|
@@ -38,17 +81,16 @@ export const adminBusinessesResolvers: FinancialEntitiesModule.Resolvers = {
|
|
|
38
81
|
}
|
|
39
82
|
return business;
|
|
40
83
|
},
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
},
|
|
84
|
+
taxAdvancesAnnualIds: admin => yearlyIdsSchema.parse(admin.tax_advances_ids),
|
|
85
|
+
taxAdvancesRates: admin =>
|
|
86
|
+
taxAdvancesRatesSchema.parse(admin.advance_tax_rates) as Array<{
|
|
87
|
+
date: TimelessDateString;
|
|
88
|
+
rate: number;
|
|
89
|
+
}>,
|
|
90
|
+
withholdingTaxCompanyId: admin => admin.company_tax_id,
|
|
91
|
+
withholdingTaxAnnualIds: admin => yearlyIdsSchema.parse(admin.withholding_tax_annual_ids),
|
|
92
|
+
socialSecurityDeductionsId: admin => `${admin.company_tax_id}00`,
|
|
93
|
+
socialSecurityEmployerIds: admin => yearlyIdsSchema.parse(admin.social_security_employer_ids),
|
|
52
94
|
},
|
|
53
95
|
LtdFinancialEntity: {
|
|
54
96
|
adminInfo: async (parentBusiness, _, { injector }) => {
|