@accounter/server 0.0.8-alpha-20251029235231-f14290dbb5dedec255de3cef292d3b4c5c71298e → 0.0.8-alpha-20251030162201-d2f279aafe537912ec3546af855cbd3a38ac0f5c

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.
Files changed (29) hide show
  1. package/CHANGELOG.md +20 -5
  2. package/dist/green-invoice-graphql/src/mesh-artifacts/index.d.ts +1 -1
  3. package/dist/server/src/__generated__/types.d.ts +70 -18
  4. package/dist/server/src/__generated__/types.js.map +1 -1
  5. package/dist/server/src/modules/financial-entities/__generated__/admin-businesses.types.d.ts +57 -0
  6. package/dist/server/src/modules/financial-entities/__generated__/admin-businesses.types.js +0 -1
  7. package/dist/server/src/modules/financial-entities/__generated__/admin-businesses.types.js.map +1 -1
  8. package/dist/server/src/modules/financial-entities/__generated__/types.d.ts +33 -10
  9. package/dist/server/src/modules/financial-entities/__generated__/types.js.map +1 -1
  10. package/dist/server/src/modules/financial-entities/helpers/admin-businesses.helper.d.ts +31 -0
  11. package/dist/server/src/modules/financial-entities/helpers/admin-businesses.helper.js +27 -0
  12. package/dist/server/src/modules/financial-entities/helpers/admin-businesses.helper.js.map +1 -0
  13. package/dist/server/src/modules/financial-entities/providers/admin-businesses.provider.d.ts +2 -1
  14. package/dist/server/src/modules/financial-entities/providers/admin-businesses.provider.js +37 -0
  15. package/dist/server/src/modules/financial-entities/providers/admin-businesses.provider.js.map +1 -1
  16. package/dist/server/src/modules/financial-entities/resolvers/admin-businesses.resolver.js +46 -11
  17. package/dist/server/src/modules/financial-entities/resolvers/admin-businesses.resolver.js.map +1 -1
  18. package/dist/server/src/modules/financial-entities/typeDefs/admin-businesses.graphql.js +49 -16
  19. package/dist/server/src/modules/financial-entities/typeDefs/admin-businesses.graphql.js.map +1 -1
  20. package/dist/server/src/modules/financial-entities/types.d.ts +1 -1
  21. package/package.json +3 -3
  22. package/src/__generated__/types.ts +76 -18
  23. package/src/modules/financial-entities/__generated__/admin-businesses.types.ts +60 -0
  24. package/src/modules/financial-entities/__generated__/types.ts +33 -10
  25. package/src/modules/financial-entities/helpers/admin-businesses.helper.ts +33 -0
  26. package/src/modules/financial-entities/providers/admin-businesses.provider.ts +44 -0
  27. package/src/modules/financial-entities/resolvers/admin-businesses.resolver.ts +53 -11
  28. package/src/modules/financial-entities/typeDefs/admin-businesses.graphql.ts +49 -16
  29. package/src/modules/financial-entities/types.ts +1 -1
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @accounter/server
2
2
 
3
- ## 0.0.8-alpha-20251029235231-f14290dbb5dedec255de3cef292d3b4c5c71298e
3
+ ## 0.0.8-alpha-20251030162201-d2f279aafe537912ec3546af855cbd3a38ac0f5c
4
4
 
5
5
  ### Patch Changes
6
6
 
@@ -469,6 +469,21 @@
469
469
  streamline the process of adding new businesses, specifically by simplifying the handling of tax
470
470
  category insertions.
471
471
 
472
+ - [#2645](https://github.com/Urigo/accounter-fullstack/pull/2645)
473
+ [`69331f9`](https://github.com/Urigo/accounter-fullstack/commit/69331f9b74e1afdc954f3cddb93735445fb9ad8d)
474
+ Thanks [@gilgardosh](https://github.com/gilgardosh)! - - **Database Schema Refactor**: The
475
+ `businesses_admin` table is updated to replace single-value fields for tax and social security
476
+ identifiers with array-based JSONB columns, allowing for multiple annual IDs and historical tax
477
+ rates.
478
+ - **GraphQL Schema Update**: The GraphQL `AdminBusiness` type and related input types
479
+ (`CreateAdminBusinessInput`, `UpdateAdminBusinessInput`) are modified to reflect the new array
480
+ structures, introducing `AnnualId` and `TaxAdvancesRate` types.
481
+ - **Frontend Form Overhaul**: The `admin-business-section.tsx` component is refactored to use
482
+ `react-hook-form`'s `useFieldArray` for dynamic management of annual IDs and tax rates,
483
+ providing a more flexible user interface.
484
+ - **Backend Logic Adaptation**: New Zod schemas and resolver logic are implemented on the server
485
+ to validate and process the updated array-based data for admin business updates.
486
+
472
487
  - [#2640](https://github.com/Urigo/accounter-fullstack/pull/2640)
473
488
  [`26618ff`](https://github.com/Urigo/accounter-fullstack/commit/26618ff2d4a47d63e16ecec59f39887f48df52cf)
474
489
  Thanks [@gilgardosh](https://github.com/gilgardosh)! - - **Renaming and Restructuring**: Key
@@ -506,10 +521,10 @@
506
521
  [`65e3c7f`](https://github.com/Urigo/accounter-fullstack/commit/65e3c7f01993eb4f41244a40feefefa08b31a4e6),
507
522
  [`65e3c7f`](https://github.com/Urigo/accounter-fullstack/commit/65e3c7f01993eb4f41244a40feefefa08b31a4e6),
508
523
  [`65e3c7f`](https://github.com/Urigo/accounter-fullstack/commit/65e3c7f01993eb4f41244a40feefefa08b31a4e6)]:
509
- - @accounter/green-invoice-graphql@0.8.2-alpha-20251029235231-f14290dbb5dedec255de3cef292d3b4c5c71298e
510
- - @accounter/pcn874-generator@0.6.3-alpha-20251029235231-f14290dbb5dedec255de3cef292d3b4c5c71298e
511
- - @accounter/shaam-uniform-format-generator@0.2.2-alpha-20251029235231-f14290dbb5dedec255de3cef292d3b4c5c71298e
512
- - @accounter/shaam6111-generator@0.1.4-alpha-20251029235231-f14290dbb5dedec255de3cef292d3b4c5c71298e
524
+ - @accounter/green-invoice-graphql@0.8.2-alpha-20251030162201-d2f279aafe537912ec3546af855cbd3a38ac0f5c
525
+ - @accounter/pcn874-generator@0.6.3-alpha-20251030162201-d2f279aafe537912ec3546af855cbd3a38ac0f5c
526
+ - @accounter/shaam-uniform-format-generator@0.2.2-alpha-20251030162201-d2f279aafe537912ec3546af855cbd3a38ac0f5c
527
+ - @accounter/shaam6111-generator@0.1.4-alpha-20251030162201-d2f279aafe537912ec3546af855cbd3a38ac0f5c
513
528
 
514
529
  ## 0.0.7
515
530
 
@@ -4,8 +4,8 @@ import type { GetMeshOptions } from '@graphql-mesh/runtime';
4
4
  import type { YamlConfig } from '@graphql-mesh/types';
5
5
  import { MeshHTTPHandler } from '@graphql-mesh/http';
6
6
  import { type ExecuteMeshFn, type SubscribeMeshFn, type MeshContext as BaseMeshContext, type MeshInstance } from '@graphql-mesh/runtime';
7
- import type { GreenInvoiceNewTypes } from './sources/GreenInvoiceNew/types';
8
7
  import type { GreenInvoiceTypes } from './sources/GreenInvoice/types';
8
+ import type { GreenInvoiceNewTypes } from './sources/GreenInvoiceNew/types';
9
9
  export type Maybe<T> = T | null;
10
10
  export type InputMaybe<T> = Maybe<T>;
11
11
  export type Exact<T extends {
@@ -193,11 +193,15 @@ export type AdminBusiness = {
193
193
  readonly id: Scalars['UUID']['output'];
194
194
  readonly name: Scalars['String']['output'];
195
195
  readonly registrationDate: Scalars['TimelessDate']['output'];
196
- readonly socialSecurityEmployerId?: Maybe<Scalars['String']['output']>;
197
- readonly taxAdvancesId?: Maybe<Scalars['String']['output']>;
198
- readonly taxAdvancesRate?: Maybe<Scalars['Float']['output']>;
199
- readonly withholdingTaxBookNumber?: Maybe<Scalars['String']['output']>;
200
- readonly withholdingTaxFileNumber?: Maybe<Scalars['String']['output']>;
196
+ /** Social Security Info */
197
+ readonly socialSecurityDeductionsId?: Maybe<Scalars['String']['output']>;
198
+ readonly socialSecurityEmployerIds: ReadonlyArray<AnnualId>;
199
+ /** Tax Advances Info */
200
+ readonly taxAdvancesAnnualIds: ReadonlyArray<AnnualId>;
201
+ readonly taxAdvancesRates: ReadonlyArray<TaxAdvancesRate>;
202
+ readonly withholdingTaxAnnualIds: ReadonlyArray<AnnualId>;
203
+ /** Withholding Tax Info */
204
+ readonly withholdingTaxCompanyId?: Maybe<Scalars['String']['output']>;
201
205
  };
202
206
  /** defines a tag / category for charge arrangement */
203
207
  export type AdminContext = {
@@ -331,6 +335,17 @@ export type AdminContextInput = {
331
335
  readonly zkufotExpensesTaxCategoryId?: InputMaybe<Scalars['UUID']['input']>;
332
336
  readonly zkufotIncomeTaxCategoryId?: InputMaybe<Scalars['UUID']['input']>;
333
337
  };
338
+ /** Represents an annual identifier for tax purposes. */
339
+ export type AnnualId = {
340
+ readonly __typename?: 'AnnualId';
341
+ readonly id: Scalars['String']['output'];
342
+ readonly year: Scalars['Int']['output'];
343
+ };
344
+ /** Input type representing an annual identifier for tax purposes. */
345
+ export type AnnualIdInput = {
346
+ readonly id: Scalars['String']['input'];
347
+ readonly year: Scalars['Int']['input'];
348
+ };
334
349
  /** Audit opinion type enum (חוות דעת) */
335
350
  export type AuditOpinionType =
336
351
  /** Adverse opinion (שלילית) */
@@ -1107,12 +1122,12 @@ export type Country = {
1107
1122
  /** Input type for creating a new admin business. */
1108
1123
  export type CreateAdminBusinessInput = {
1109
1124
  readonly businessId: Scalars['UUID']['input'];
1125
+ readonly companyTaxId: Scalars['String']['input'];
1110
1126
  readonly registrationDate: Scalars['TimelessDate']['input'];
1111
1127
  readonly socialSecurityEmployerId?: InputMaybe<Scalars['String']['input']>;
1112
- readonly taxAdvancesId?: InputMaybe<Scalars['String']['input']>;
1128
+ readonly taxAdvancesAnnualId?: InputMaybe<Scalars['String']['input']>;
1113
1129
  readonly taxAdvancesRate?: InputMaybe<Scalars['Float']['input']>;
1114
- readonly withholdingTaxBookNumber?: InputMaybe<Scalars['String']['input']>;
1115
- readonly withholdingTaxFileNumber?: InputMaybe<Scalars['String']['input']>;
1130
+ readonly withholdingTaxAnnualId?: InputMaybe<Scalars['String']['input']>;
1116
1131
  };
1117
1132
  /** input for creating a new contract */
1118
1133
  export type CreateContractInput = {
@@ -3541,6 +3556,17 @@ export type Tag = {
3541
3556
  export type TagInput = {
3542
3557
  readonly id: Scalars['String']['input'];
3543
3558
  };
3559
+ /** Represents the tax advance rate for a specific date. */
3560
+ export type TaxAdvancesRate = {
3561
+ readonly __typename?: 'TaxAdvancesRate';
3562
+ readonly date: Scalars['TimelessDate']['output'];
3563
+ readonly rate: Scalars['Float']['output'];
3564
+ };
3565
+ /** Input type representing the tax advance rate for a specific date. */
3566
+ export type TaxAdvancesRateInput = {
3567
+ readonly date: Scalars['TimelessDate']['input'];
3568
+ readonly rate: Scalars['Float']['input'];
3569
+ };
3544
3570
  /** Tax category entity used for ledger records */
3545
3571
  export type TaxCategory = FinancialEntity & {
3546
3572
  readonly __typename?: 'TaxCategory';
@@ -3655,12 +3681,17 @@ export type Unprocessed = Document & Linkable & {
3655
3681
  };
3656
3682
  /** Input type for updating admin business details. */
3657
3683
  export type UpdateAdminBusinessInput = {
3684
+ readonly governmentId?: InputMaybe<Scalars['String']['input']>;
3685
+ readonly name?: InputMaybe<Scalars['String']['input']>;
3658
3686
  readonly registrationDate?: InputMaybe<Scalars['TimelessDate']['input']>;
3659
- readonly socialSecurityEmployerId?: InputMaybe<Scalars['String']['input']>;
3660
- readonly taxAdvancesId?: InputMaybe<Scalars['String']['input']>;
3661
- readonly taxAdvancesRate?: InputMaybe<Scalars['Float']['input']>;
3662
- readonly withholdingTaxBookNumber?: InputMaybe<Scalars['String']['input']>;
3663
- readonly withholdingTaxFileNumber?: InputMaybe<Scalars['String']['input']>;
3687
+ /** Social Security Info */
3688
+ readonly socialSecurityEmployerIds?: InputMaybe<ReadonlyArray<AnnualIdInput>>;
3689
+ /** Tax Advances Info */
3690
+ readonly taxAdvancesAnnualIds?: InputMaybe<ReadonlyArray<AnnualIdInput>>;
3691
+ readonly taxAdvancesRates?: InputMaybe<ReadonlyArray<TaxAdvancesRateInput>>;
3692
+ readonly withholdingTaxAnnualIds?: InputMaybe<ReadonlyArray<AnnualIdInput>>;
3693
+ /** Withholding Tax Info */
3694
+ readonly withholdingTaxCompanyId?: InputMaybe<Scalars['String']['input']>;
3664
3695
  };
3665
3696
  /** input for updateBusiness */
3666
3697
  export type UpdateBusinessInput = {
@@ -4092,6 +4123,8 @@ export type ResolversTypes = {
4092
4123
  AdminBusiness: ResolverTypeWrapper<IGetAllAdminBusinessesResult>;
4093
4124
  AdminContext: ResolverTypeWrapper<IGetAdminContextsResult>;
4094
4125
  AdminContextInput: AdminContextInput;
4126
+ AnnualId: ResolverTypeWrapper<AnnualId>;
4127
+ AnnualIdInput: AnnualIdInput;
4095
4128
  AuditOpinionType: AuditOpinionType;
4096
4129
  BalanceTransactions: ResolverTypeWrapper<IGetNormalizedBalanceTransactionsResult>;
4097
4130
  BankDeposit: ResolverTypeWrapper<Omit<BankDeposit, 'transactions'> & {
@@ -4361,6 +4394,8 @@ export type ResolversTypes = {
4361
4394
  SuggestionsInput: SuggestionsInput;
4362
4395
  Tag: ResolverTypeWrapper<IGetAllTagsResult>;
4363
4396
  TagInput: TagInput;
4397
+ TaxAdvancesRate: ResolverTypeWrapper<TaxAdvancesRate>;
4398
+ TaxAdvancesRateInput: TaxAdvancesRateInput;
4364
4399
  TaxCategory: ResolverTypeWrapper<IGetAllTaxCategoriesResult>;
4365
4400
  TaxReport: ResolverTypeWrapper<Omit<TaxReport, 'reference' | 'report'> & {
4366
4401
  reference: ReadonlyArray<ResolversTypes['TaxReportYear']>;
@@ -4459,6 +4494,8 @@ export type ResolversParentTypes = {
4459
4494
  AdminBusiness: IGetAllAdminBusinessesResult;
4460
4495
  AdminContext: IGetAdminContextsResult;
4461
4496
  AdminContextInput: AdminContextInput;
4497
+ AnnualId: AnnualId;
4498
+ AnnualIdInput: AnnualIdInput;
4462
4499
  BalanceTransactions: IGetNormalizedBalanceTransactionsResult;
4463
4500
  BankDeposit: Omit<BankDeposit, 'transactions'> & {
4464
4501
  transactions: ReadonlyArray<ResolversParentTypes['Transaction']>;
@@ -4693,6 +4730,8 @@ export type ResolversParentTypes = {
4693
4730
  SuggestionsInput: SuggestionsInput;
4694
4731
  Tag: IGetAllTagsResult;
4695
4732
  TagInput: TagInput;
4733
+ TaxAdvancesRate: TaxAdvancesRate;
4734
+ TaxAdvancesRateInput: TaxAdvancesRateInput;
4696
4735
  TaxCategory: IGetAllTaxCategoriesResult;
4697
4736
  TaxReport: Omit<TaxReport, 'reference' | 'report'> & {
4698
4737
  reference: ReadonlyArray<ResolversParentTypes['TaxReportYear']>;
@@ -4794,11 +4833,12 @@ export type AdminBusinessResolvers<ContextType = GraphQLModules.Context, ParentT
4794
4833
  id?: Resolver<ResolversTypes['UUID'], ParentType, ContextType>;
4795
4834
  name?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
4796
4835
  registrationDate?: Resolver<ResolversTypes['TimelessDate'], ParentType, ContextType>;
4797
- socialSecurityEmployerId?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
4798
- taxAdvancesId?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
4799
- taxAdvancesRate?: Resolver<Maybe<ResolversTypes['Float']>, ParentType, ContextType>;
4800
- withholdingTaxBookNumber?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
4801
- withholdingTaxFileNumber?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
4836
+ socialSecurityDeductionsId?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
4837
+ socialSecurityEmployerIds?: Resolver<ReadonlyArray<ResolversTypes['AnnualId']>, ParentType, ContextType>;
4838
+ taxAdvancesAnnualIds?: Resolver<ReadonlyArray<ResolversTypes['AnnualId']>, ParentType, ContextType>;
4839
+ taxAdvancesRates?: Resolver<ReadonlyArray<ResolversTypes['TaxAdvancesRate']>, ParentType, ContextType>;
4840
+ withholdingTaxAnnualIds?: Resolver<ReadonlyArray<ResolversTypes['AnnualId']>, ParentType, ContextType>;
4841
+ withholdingTaxCompanyId?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
4802
4842
  __isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
4803
4843
  };
4804
4844
  export type AdminContextResolvers<ContextType = GraphQLModules.Context, ParentType extends ResolversParentTypes['AdminContext'] = ResolversParentTypes['AdminContext']> = {
@@ -4867,6 +4907,11 @@ export type AdminContextResolvers<ContextType = GraphQLModules.Context, ParentTy
4867
4907
  zkufotIncomeTaxCategory?: Resolver<Maybe<ResolversTypes['TaxCategory']>, ParentType, ContextType>;
4868
4908
  __isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
4869
4909
  };
4910
+ export type AnnualIdResolvers<ContextType = GraphQLModules.Context, ParentType extends ResolversParentTypes['AnnualId'] = ResolversParentTypes['AnnualId']> = {
4911
+ id?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
4912
+ year?: Resolver<ResolversTypes['Int'], ParentType, ContextType>;
4913
+ __isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
4914
+ };
4870
4915
  export type BalanceTransactionsResolvers<ContextType = GraphQLModules.Context, ParentType extends ResolversParentTypes['BalanceTransactions'] = ResolversParentTypes['BalanceTransactions']> = {
4871
4916
  amount?: Resolver<ResolversTypes['FinancialAmount'], ParentType, ContextType>;
4872
4917
  amountUsd?: Resolver<ResolversTypes['FinancialAmount'], ParentType, ContextType>;
@@ -6661,6 +6706,11 @@ export type TagResolvers<ContextType = GraphQLModules.Context, ParentType extend
6661
6706
  parent?: Resolver<Maybe<ResolversTypes['Tag']>, ParentType, ContextType>;
6662
6707
  __isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
6663
6708
  };
6709
+ export type TaxAdvancesRateResolvers<ContextType = GraphQLModules.Context, ParentType extends ResolversParentTypes['TaxAdvancesRate'] = ResolversParentTypes['TaxAdvancesRate']> = {
6710
+ date?: Resolver<ResolversTypes['TimelessDate'], ParentType, ContextType>;
6711
+ rate?: Resolver<ResolversTypes['Float'], ParentType, ContextType>;
6712
+ __isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
6713
+ };
6664
6714
  export type TaxCategoryResolvers<ContextType = GraphQLModules.Context, ParentType extends ResolversParentTypes['TaxCategory'] = ResolversParentTypes['TaxCategory']> = {
6665
6715
  createdAt?: Resolver<ResolversTypes['DateTime'], ParentType, ContextType>;
6666
6716
  id?: Resolver<ResolversTypes['UUID'], ParentType, ContextType>;
@@ -6893,6 +6943,7 @@ export type YearlyLedgerReportFinancialEntityInfoResolvers<ContextType = GraphQL
6893
6943
  export type Resolvers<ContextType = GraphQLModules.Context> = {
6894
6944
  AdminBusiness?: AdminBusinessResolvers<ContextType>;
6895
6945
  AdminContext?: AdminContextResolvers<ContextType>;
6946
+ AnnualId?: AnnualIdResolvers<ContextType>;
6896
6947
  BalanceTransactions?: BalanceTransactionsResolvers<ContextType>;
6897
6948
  BankDeposit?: BankDepositResolvers<ContextType>;
6898
6949
  BankDepositCharge?: BankDepositChargeResolvers<ContextType>;
@@ -7038,6 +7089,7 @@ export type Resolvers<ContextType = GraphQLModules.Context> = {
7038
7089
  Suggestions?: SuggestionsResolvers<ContextType>;
7039
7090
  SuggestionsEmailListenerConfig?: SuggestionsEmailListenerConfigResolvers<ContextType>;
7040
7091
  Tag?: TagResolvers<ContextType>;
7092
+ TaxAdvancesRate?: TaxAdvancesRateResolvers<ContextType>;
7041
7093
  TaxCategory?: TaxCategoryResolvers<ContextType>;
7042
7094
  TaxReport?: TaxReportResolvers<ContextType>;
7043
7095
  TaxReportYear?: TaxReportYearResolvers<ContextType>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/__generated__/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAq2BrD,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAyX7B,OAAO,EAAE,QAAQ,EAAE,CAAC;AAuLpB,OAAO,EAAE,YAAY,EAAE,CAAC;AA2lCxB,OAAO,EAAE,iBAAiB,EAAE,CAAC;AA23D7B,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/__generated__/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAs3BrD,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAyX7B,OAAO,EAAE,QAAQ,EAAE,CAAC;AAuLpB,OAAO,EAAE,YAAY,EAAE,CAAC;AA2lCxB,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAw4D7B,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
@@ -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
+ export type Json = null | boolean | number | string | Json[] | {
4
+ [key: string]: Json;
5
+ };
6
+ export type JsonArray = (Json)[];
2
7
  /** 'GetAdminBusinessesByIds' parameters type */
3
8
  export interface IGetAdminBusinessesByIdsParams {
4
9
  ids: readonly (string | null | void)[];
@@ -6,6 +11,9 @@ export interface IGetAdminBusinessesByIdsParams {
6
11
  /** 'GetAdminBusinessesByIds' return type */
7
12
  export interface IGetAdminBusinessesByIdsResult {
8
13
  advance_tax_rate: number | null;
14
+ advance_tax_rates: JsonArray;
15
+ business_registration_start_date: Date | null;
16
+ company_tax_id: string | null;
9
17
  id: string;
10
18
  name: string;
11
19
  nikuim: string | null;
@@ -13,6 +21,8 @@ export interface IGetAdminBusinessesByIdsResult {
13
21
  pinkas_social_security_2021: string | null;
14
22
  pinkas_social_security_2022: string | null;
15
23
  registration_date: Date | null;
24
+ social_security_employer_ids: JsonArray;
25
+ tax_advances_ids: JsonArray;
16
26
  tax_nikuim_pinkas_number: string | null;
17
27
  tax_pinkas_number_2020: string | null;
18
28
  tax_siduri_number_2021: string | null;
@@ -21,6 +31,7 @@ export interface IGetAdminBusinessesByIdsResult {
21
31
  vat_number: string | null;
22
32
  vat_report_cadence: number | null;
23
33
  website_login_screenshot: string | null;
34
+ withholding_tax_annual_ids: JsonArray;
24
35
  wizcloud_company_id: string | null;
25
36
  wizcloud_token: string | null;
26
37
  }
@@ -34,6 +45,9 @@ export type IGetAllAdminBusinessesParams = void;
34
45
  /** 'GetAllAdminBusinesses' return type */
35
46
  export interface IGetAllAdminBusinessesResult {
36
47
  advance_tax_rate: number | null;
48
+ advance_tax_rates: JsonArray;
49
+ business_registration_start_date: Date | null;
50
+ company_tax_id: string | null;
37
51
  id: string;
38
52
  name: string;
39
53
  nikuim: string | null;
@@ -41,6 +55,8 @@ export interface IGetAllAdminBusinessesResult {
41
55
  pinkas_social_security_2021: string | null;
42
56
  pinkas_social_security_2022: string | null;
43
57
  registration_date: Date | null;
58
+ social_security_employer_ids: JsonArray;
59
+ tax_advances_ids: JsonArray;
44
60
  tax_nikuim_pinkas_number: string | null;
45
61
  tax_pinkas_number_2020: string | null;
46
62
  tax_siduri_number_2021: string | null;
@@ -49,6 +65,7 @@ export interface IGetAllAdminBusinessesResult {
49
65
  vat_number: string | null;
50
66
  vat_report_cadence: number | null;
51
67
  website_login_screenshot: string | null;
68
+ withholding_tax_annual_ids: JsonArray;
52
69
  wizcloud_company_id: string | null;
53
70
  wizcloud_token: string | null;
54
71
  }
@@ -57,3 +74,43 @@ export interface IGetAllAdminBusinessesQuery {
57
74
  params: IGetAllAdminBusinessesParams;
58
75
  result: IGetAllAdminBusinessesResult;
59
76
  }
77
+ /** 'UpdateAdminBusinesses' parameters type */
78
+ export interface IUpdateAdminBusinessesParams {
79
+ advanceTaxRates?: JsonArray | null | void;
80
+ businessRegistrationStartDate?: DateOrString | null | void;
81
+ companyTaxId?: string | null | void;
82
+ id?: string | null | void;
83
+ socialSecurityEmployerIds?: JsonArray | null | void;
84
+ taxAdvancesIds?: JsonArray | null | void;
85
+ withholdingTaxAnnualIds?: JsonArray | null | void;
86
+ }
87
+ /** 'UpdateAdminBusinesses' return type */
88
+ export interface IUpdateAdminBusinessesResult {
89
+ advance_tax_rate: number | null;
90
+ advance_tax_rates: JsonArray;
91
+ business_registration_start_date: Date | null;
92
+ company_tax_id: string | null;
93
+ id: string;
94
+ nikuim: string | null;
95
+ password: string | null;
96
+ pinkas_social_security_2021: string | null;
97
+ pinkas_social_security_2022: string | null;
98
+ registration_date: Date | null;
99
+ social_security_employer_ids: JsonArray;
100
+ tax_advances_ids: JsonArray;
101
+ tax_nikuim_pinkas_number: string | null;
102
+ tax_pinkas_number_2020: string | null;
103
+ tax_siduri_number_2021: string | null;
104
+ tax_siduri_number_2022: string | null;
105
+ username_vat_website: string | null;
106
+ vat_report_cadence: number | null;
107
+ website_login_screenshot: string | null;
108
+ withholding_tax_annual_ids: JsonArray;
109
+ wizcloud_company_id: string | null;
110
+ wizcloud_token: string | null;
111
+ }
112
+ /** 'UpdateAdminBusinesses' query type */
113
+ export interface IUpdateAdminBusinessesQuery {
114
+ params: IUpdateAdminBusinessesParams;
115
+ result: IUpdateAdminBusinessesResult;
116
+ }
@@ -1,3 +1,2 @@
1
- /** Types generated for queries found in "src/modules/financial-entities/providers/admin-businesses.provider.ts" */
2
1
  export {};
3
2
  //# sourceMappingURL=admin-businesses.types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"admin-businesses.types.js","sourceRoot":"","sources":["../../../../../../src/modules/financial-entities/__generated__/admin-businesses.types.ts"],"names":[],"mappings":"AAAA,mHAAmH"}
1
+ {"version":3,"file":"admin-businesses.types.js","sourceRoot":"","sources":["../../../../../../src/modules/financial-entities/__generated__/admin-businesses.types.ts"],"names":[],"mappings":""}
@@ -4,7 +4,9 @@ export declare 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' | 'withholdingTaxBookNumber' | 'withholdingTaxFileNumber' | 'socialSecurityEmployerId' | 'taxAdvancesRate' | 'taxAdvancesId' | 'registrationDate';
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';
@@ -48,8 +50,10 @@ export declare namespace FinancialEntitiesModule {
48
50
  EmailAttachmentType: 'PDF' | 'PNG' | 'JPEG';
49
51
  }
50
52
  interface DefinedInputFields {
51
- CreateAdminBusinessInput: 'businessId' | 'withholdingTaxBookNumber' | 'withholdingTaxFileNumber' | 'socialSecurityEmployerId' | 'taxAdvancesRate' | 'taxAdvancesId' | 'registrationDate';
52
- UpdateAdminBusinessInput: 'withholdingTaxBookNumber' | 'withholdingTaxFileNumber' | 'socialSecurityEmployerId' | 'taxAdvancesRate' | 'taxAdvancesId' | 'registrationDate';
53
+ CreateAdminBusinessInput: 'businessId' | 'registrationDate' | 'companyTaxId' | 'taxAdvancesAnnualId' | 'taxAdvancesRate' | 'withholdingTaxAnnualId' | 'socialSecurityEmployerId';
54
+ UpdateAdminBusinessInput: 'name' | 'governmentId' | 'registrationDate' | 'taxAdvancesAnnualIds' | 'taxAdvancesRates' | 'withholdingTaxCompanyId' | 'withholdingTaxAnnualIds' | 'socialSecurityEmployerIds';
55
+ AnnualIdInput: 'year' | 'id';
56
+ TaxAdvancesRateInput: 'date' | 'rate';
53
57
  BusinessTransactionsFilter: 'businessIDs' | 'ownerIds' | 'type' | 'fromDate' | 'toDate' | 'includeRevaluation';
54
58
  UpdateBusinessInput: 'name' | 'sortCode' | 'country' | 'hebrewName' | 'address' | 'email' | 'website' | 'phoneNumber' | 'governmentId' | 'taxCategory' | 'exemptDealer' | 'suggestions' | 'optionalVAT' | 'isReceiptEnough' | 'isDocumentsOptional' | 'pcn874RecordType' | 'irsCode' | 'isActive';
55
59
  InsertNewBusinessInput: 'name' | 'sortCode' | 'country' | 'hebrewName' | 'address' | 'email' | 'website' | 'phoneNumber' | 'governmentId' | 'taxCategory' | 'exemptDealer' | 'suggestions' | 'optionalVAT' | 'isReceiptEnough' | 'isDocumentsOptional' | 'pcn874RecordType' | 'irsCode' | 'isActive';
@@ -67,8 +71,12 @@ export declare namespace FinancialEntitiesModule {
67
71
  export type Mutation = Pick<Types.Mutation, DefinedFields['Mutation']>;
68
72
  export type CreateAdminBusinessInput = Pick<Types.CreateAdminBusinessInput, DefinedInputFields['CreateAdminBusinessInput']>;
69
73
  export type UpdateAdminBusinessInput = Pick<Types.UpdateAdminBusinessInput, DefinedInputFields['UpdateAdminBusinessInput']>;
70
- export type LtdFinancialEntity = Pick<Types.LtdFinancialEntity, DefinedFields['LtdFinancialEntity']>;
71
74
  export type TimelessDate = Types.TimelessDate;
75
+ export type LtdFinancialEntity = Pick<Types.LtdFinancialEntity, DefinedFields['LtdFinancialEntity']>;
76
+ export type AnnualId = Pick<Types.AnnualId, DefinedFields['AnnualId']>;
77
+ export type TaxAdvancesRate = Pick<Types.TaxAdvancesRate, DefinedFields['TaxAdvancesRate']>;
78
+ export type AnnualIdInput = Pick<Types.AnnualIdInput, DefinedInputFields['AnnualIdInput']>;
79
+ export type TaxAdvancesRateInput = Pick<Types.TaxAdvancesRateInput, DefinedInputFields['TaxAdvancesRateInput']>;
72
80
  export type BusinessTransactionsSumFromLedgerRecordsResult = Types.BusinessTransactionsSumFromLedgerRecordsResult;
73
81
  export type BusinessTransactionsFilter = Pick<Types.BusinessTransactionsFilter, DefinedInputFields['BusinessTransactionsFilter']>;
74
82
  export type BusinessTransactionsFromLedgerRecordsResult = Types.BusinessTransactionsFromLedgerRecordsResult;
@@ -135,6 +143,8 @@ export declare namespace FinancialEntitiesModule {
135
143
  export type QueryResolvers = Pick<Types.QueryResolvers, DefinedFields['Query']>;
136
144
  export type MutationResolvers = Pick<Types.MutationResolvers, DefinedFields['Mutation']>;
137
145
  export type AdminBusinessResolvers = Pick<Types.AdminBusinessResolvers, DefinedFields['AdminBusiness']>;
146
+ export type AnnualIdResolvers = Pick<Types.AnnualIdResolvers, DefinedFields['AnnualId']>;
147
+ export type TaxAdvancesRateResolvers = Pick<Types.TaxAdvancesRateResolvers, DefinedFields['TaxAdvancesRate']>;
138
148
  export type BusinessTransactionsSumFromLedgerRecordsSuccessfulResultResolvers = Pick<Types.BusinessTransactionsSumFromLedgerRecordsSuccessfulResultResolvers, DefinedFields['BusinessTransactionsSumFromLedgerRecordsSuccessfulResult'] | '__isTypeOf'>;
139
149
  export type BusinessTransactionSumResolvers = Pick<Types.BusinessTransactionSumResolvers, DefinedFields['BusinessTransactionSum']>;
140
150
  export type ForeignCurrencySumResolvers = Pick<Types.ForeignCurrencySumResolvers, DefinedFields['ForeignCurrencySum']>;
@@ -176,6 +186,8 @@ export declare namespace FinancialEntitiesModule {
176
186
  Query?: QueryResolvers;
177
187
  Mutation?: MutationResolvers;
178
188
  AdminBusiness?: AdminBusinessResolvers;
189
+ AnnualId?: AnnualIdResolvers;
190
+ TaxAdvancesRate?: TaxAdvancesRateResolvers;
179
191
  BusinessTransactionsSumFromLedgerRecordsSuccessfulResult?: BusinessTransactionsSumFromLedgerRecordsSuccessfulResultResolvers;
180
192
  BusinessTransactionSum?: BusinessTransactionSumResolvers;
181
193
  ForeignCurrencySum?: ForeignCurrencySumResolvers;
@@ -249,13 +261,24 @@ export declare namespace FinancialEntitiesModule {
249
261
  id?: gm.Middleware[];
250
262
  name?: gm.Middleware[];
251
263
  governmentId?: gm.Middleware[];
252
- business?: gm.Middleware[];
253
- withholdingTaxBookNumber?: gm.Middleware[];
254
- withholdingTaxFileNumber?: gm.Middleware[];
255
- socialSecurityEmployerId?: gm.Middleware[];
256
- taxAdvancesRate?: gm.Middleware[];
257
- taxAdvancesId?: gm.Middleware[];
258
264
  registrationDate?: gm.Middleware[];
265
+ business?: gm.Middleware[];
266
+ taxAdvancesAnnualIds?: gm.Middleware[];
267
+ taxAdvancesRates?: gm.Middleware[];
268
+ withholdingTaxCompanyId?: gm.Middleware[];
269
+ withholdingTaxAnnualIds?: gm.Middleware[];
270
+ socialSecurityDeductionsId?: gm.Middleware[];
271
+ socialSecurityEmployerIds?: gm.Middleware[];
272
+ };
273
+ AnnualId?: {
274
+ '*'?: gm.Middleware[];
275
+ year?: gm.Middleware[];
276
+ id?: gm.Middleware[];
277
+ };
278
+ TaxAdvancesRate?: {
279
+ '*'?: gm.Middleware[];
280
+ date?: gm.Middleware[];
281
+ rate?: gm.Middleware[];
259
282
  };
260
283
  LtdFinancialEntity?: {
261
284
  '*'?: gm.Middleware[];
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../src/modules/financial-entities/__generated__/types.ts"],"names":[],"mappings":"AAEA,MAAM,KAAW,uBAAuB,CAoevC;AApeD,WAAiB,uBAAuB;IA0CrC,CAAC;IAKD,CAAC;IAeD,CAAC;IAuJD,CAAC;IA8QD,CAAC;AACJ,CAAC,EApegB,uBAAuB,KAAvB,uBAAuB,QAoevC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../src/modules/financial-entities/__generated__/types.ts"],"names":[],"mappings":"AAEA,MAAM,KAAW,uBAAuB,CA2fvC;AA3fD,WAAiB,uBAAuB;IA4CrC,CAAC;IAKD,CAAC;IAiBD,CAAC;IA+JD,CAAC;IAyRD,CAAC;AACJ,CAAC,EA3fgB,uBAAuB,KAAvB,uBAAuB,QA2fvC"}
@@ -0,0 +1,31 @@
1
+ import { z } from 'zod';
2
+ export declare const adminBusinessUpdateSchema: z.ZodObject<{
3
+ id: z.ZodUUID;
4
+ businessRegistrationStartDate: z.ZodOptional<z.ZodISODate>;
5
+ companyTaxId: z.ZodOptional<z.ZodString>;
6
+ advanceTaxRates: z.ZodOptional<z.ZodArray<z.ZodObject<{
7
+ date: z.ZodISODate;
8
+ rate: z.ZodNumber;
9
+ }, z.core.$strict>>>;
10
+ taxAdvancesIds: z.ZodOptional<z.ZodArray<z.ZodObject<{
11
+ year: z.ZodNumber;
12
+ id: z.ZodString;
13
+ }, z.core.$strict>>>;
14
+ socialSecurityEmployerIds: z.ZodOptional<z.ZodArray<z.ZodObject<{
15
+ year: z.ZodNumber;
16
+ id: z.ZodString;
17
+ }, z.core.$strict>>>;
18
+ withholdingTaxAnnualIds: z.ZodOptional<z.ZodArray<z.ZodObject<{
19
+ year: z.ZodNumber;
20
+ id: z.ZodString;
21
+ }, z.core.$strict>>>;
22
+ }, z.core.$strict>;
23
+ export type AdminBusinessUpdateSchema = z.infer<typeof adminBusinessUpdateSchema>;
24
+ export declare const yearlyIdsSchema: z.ZodArray<z.ZodObject<{
25
+ year: z.ZodNumber;
26
+ id: z.ZodString;
27
+ }, z.core.$strict>>;
28
+ export declare const taxAdvancesRatesSchema: z.ZodArray<z.ZodObject<{
29
+ date: z.ZodISODate;
30
+ rate: z.ZodNumber;
31
+ }, z.core.$strict>>;
@@ -0,0 +1,27 @@
1
+ import { z } from 'zod';
2
+ const yearlyIdSchema = z
3
+ .object({
4
+ year: z.number().min(2000).max(2100),
5
+ id: z.string().min(1, { message: 'ID is required' }),
6
+ })
7
+ .strict();
8
+ const taxAdvanceRateSchema = z
9
+ .object({
10
+ date: z.iso.date(),
11
+ rate: z.number().min(0).max(1),
12
+ })
13
+ .strict();
14
+ export const adminBusinessUpdateSchema = z
15
+ .object({
16
+ id: z.uuid(),
17
+ businessRegistrationStartDate: z.iso.date().optional(),
18
+ companyTaxId: z.string().optional(),
19
+ advanceTaxRates: z.array(taxAdvanceRateSchema).optional(),
20
+ taxAdvancesIds: z.array(yearlyIdSchema).optional(),
21
+ socialSecurityEmployerIds: z.array(yearlyIdSchema).optional(),
22
+ withholdingTaxAnnualIds: z.array(yearlyIdSchema).optional(),
23
+ })
24
+ .strict();
25
+ export const yearlyIdsSchema = z.array(yearlyIdSchema);
26
+ export const taxAdvancesRatesSchema = z.array(taxAdvanceRateSchema);
27
+ //# sourceMappingURL=admin-businesses.helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin-businesses.helper.js","sourceRoot":"","sources":["../../../../../../src/modules/financial-entities/helpers/admin-businesses.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,cAAc,GAAG,CAAC;KACrB,MAAM,CAAC;IACN,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC;IACpC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,gBAAgB,EAAE,CAAC;CACrD,CAAC;KACD,MAAM,EAAE,CAAC;AAEZ,MAAM,oBAAoB,GAAG,CAAC;KAC3B,MAAM,CAAC;IACN,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE;IAClB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;CAC/B,CAAC;KACD,MAAM,EAAE,CAAC;AAEZ,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC;KACvC,MAAM,CAAC;IACN,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE;IACZ,6BAA6B,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;IACtD,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,eAAe,EAAE,CAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC,QAAQ,EAAE;IACzD,cAAc,EAAE,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,QAAQ,EAAE;IAClD,yBAAyB,EAAE,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,QAAQ,EAAE;IAC7D,uBAAuB,EAAE,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,QAAQ,EAAE;CAC5D,CAAC;KACD,MAAM,EAAE,CAAC;AAIZ,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;AAEvD,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import DataLoader from 'dataloader';
2
2
  import { DBProvider } from '../../app-providers/db.provider.js';
3
- import type { IGetAllAdminBusinessesResult } from '../types.js';
3
+ import type { IGetAllAdminBusinessesResult, IUpdateAdminBusinessesParams, IUpdateAdminBusinessesResult } from '../types.js';
4
4
  export declare class AdminBusinessesProvider {
5
5
  private dbProvider;
6
6
  cache: {
@@ -16,5 +16,6 @@ export declare class AdminBusinessesProvider {
16
16
  private batchAdminBusinessesByIds;
17
17
  getAdminBusinessByIdLoader: DataLoader<string, import("../types.js").IGetAdminBusinessesByIdsResult | undefined, import("node-cache").Key | import("node-cache").Key[]>;
18
18
  getAllAdminBusinesses(): Promise<IGetAllAdminBusinessesResult[]>;
19
+ updateAdminBusiness(params: IUpdateAdminBusinessesParams): Promise<IUpdateAdminBusinessesResult>;
19
20
  clearCache(): void;
20
21
  }
@@ -4,6 +4,7 @@ import { Injectable, Scope } from 'graphql-modules';
4
4
  import { DBProvider } from '../../app-providers/db.provider.js';
5
5
  import { sql } from '@pgtyped/runtime';
6
6
  import { getCacheInstance } from '../../../shared/helpers/index.js';
7
+ import { adminBusinessUpdateSchema } from '../helpers/admin-businesses.helper.js';
7
8
  const getAdminBusinessesByIds = sql `
8
9
  SELECT ab.*, f.name, b.vat_number
9
10
  FROM accounter_schema.businesses_admin ab
@@ -21,6 +22,36 @@ const getAllAdminBusinesses = sql `
21
22
  USING (id)
22
23
  INNER JOIN accounter_schema.financial_entities fe
23
24
  USING (id);`;
25
+ const updateAdminBusinesses = sql `
26
+ UPDATE accounter_schema.businesses_admin
27
+ SET
28
+ business_registration_start_date = COALESCE(
29
+ $businessRegistrationStartDate,
30
+ business_registration_start_date
31
+ ),
32
+ company_tax_id = COALESCE(
33
+ $companyTaxId,
34
+ company_tax_id
35
+ ),
36
+ advance_tax_rates = COALESCE(
37
+ $advanceTaxRates,
38
+ advance_tax_rates
39
+ ),
40
+ tax_advances_ids = COALESCE(
41
+ $taxAdvancesIds,
42
+ tax_advances_ids
43
+ ),
44
+ social_security_employer_ids = COALESCE(
45
+ $socialSecurityEmployerIds,
46
+ social_security_employer_ids
47
+ ),
48
+ withholding_tax_annual_ids = COALESCE(
49
+ $withholdingTaxAnnualIds,
50
+ withholding_tax_annual_ids
51
+ )
52
+ WHERE
53
+ id = $id
54
+ RETURNING *;`;
24
55
  let AdminBusinessesProvider = class AdminBusinessesProvider {
25
56
  dbProvider;
26
57
  cache = getCacheInstance({
@@ -50,6 +81,12 @@ let AdminBusinessesProvider = class AdminBusinessesProvider {
50
81
  return result;
51
82
  });
52
83
  }
84
+ async updateAdminBusiness(params) {
85
+ const inputParams = adminBusinessUpdateSchema.parse(params);
86
+ const [result] = await updateAdminBusinesses.run(inputParams, this.dbProvider);
87
+ this.clearCache();
88
+ return result;
89
+ }
53
90
  clearCache() {
54
91
  this.cache.clear();
55
92
  }
@@ -1 +1 @@
1
- {"version":3,"file":"admin-businesses.provider.js","sourceRoot":"","sources":["../../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E,IAAI,CAAC,KAAK;KACrB,CACF,CAAC;IAEK,qBAAqB;QAC1B,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAiC,sBAAsB,CAAC,CAAC;QACpF,IAAI,IAAI,EAAE,CAAC;YACT,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC/B,CAAC;QACD,OAAO,qBAAqB,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;YACzE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,sBAAsB,EAAE,MAAM,CAAC,CAAC;YAC/C,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,UAAU;QACf,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IACrB,CAAC;CACF,CAAA;AAxCY,uBAAuB;IAJnC,UAAU,CAAC;QACV,KAAK,EAAE,KAAK,CAAC,SAAS;QACtB,MAAM,EAAE,IAAI;KACb,CAAC;qCAMgC,UAAU;GAL/B,uBAAuB,CAwCnC"}
1
+ {"version":3,"file":"admin-businesses.provider.js","sourceRoot":"","sources":["../../../../../../src/modules/financial-entities/providers/admin-businesses.provider.ts"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AACnE,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAC;AAUlF,MAAM,uBAAuB,GAAG,GAAG,CAA+B;;;;;;;0BAOxC,CAAC;AAE3B,MAAM,qBAAqB,GAAG,GAAG,CAA6B;;;;;;;;kBAQ5C,C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