@accounter/server 0.0.8-alpha-20251030164843-d2f490daba879840366288d1f62974ab25081876 → 0.0.8-alpha-20251031025517-bd142395bc1d7267ab00d6b53b116062b581b7d8

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 (28) hide show
  1. package/CHANGELOG.md +31 -7
  2. package/dist/server/src/__generated__/types.d.ts +70 -18
  3. package/dist/server/src/__generated__/types.js.map +1 -1
  4. package/dist/server/src/modules/financial-entities/__generated__/admin-businesses.types.d.ts +57 -0
  5. package/dist/server/src/modules/financial-entities/__generated__/admin-businesses.types.js +0 -1
  6. package/dist/server/src/modules/financial-entities/__generated__/admin-businesses.types.js.map +1 -1
  7. package/dist/server/src/modules/financial-entities/__generated__/types.d.ts +33 -10
  8. package/dist/server/src/modules/financial-entities/__generated__/types.js.map +1 -1
  9. package/dist/server/src/modules/financial-entities/helpers/admin-businesses.helper.d.ts +31 -0
  10. package/dist/server/src/modules/financial-entities/helpers/admin-businesses.helper.js +27 -0
  11. package/dist/server/src/modules/financial-entities/helpers/admin-businesses.helper.js.map +1 -0
  12. package/dist/server/src/modules/financial-entities/providers/admin-businesses.provider.d.ts +2 -1
  13. package/dist/server/src/modules/financial-entities/providers/admin-businesses.provider.js +37 -0
  14. package/dist/server/src/modules/financial-entities/providers/admin-businesses.provider.js.map +1 -1
  15. package/dist/server/src/modules/financial-entities/resolvers/admin-businesses.resolver.js +46 -11
  16. package/dist/server/src/modules/financial-entities/resolvers/admin-businesses.resolver.js.map +1 -1
  17. package/dist/server/src/modules/financial-entities/typeDefs/admin-businesses.graphql.js +49 -16
  18. package/dist/server/src/modules/financial-entities/typeDefs/admin-businesses.graphql.js.map +1 -1
  19. package/dist/server/src/modules/financial-entities/types.d.ts +1 -1
  20. package/package.json +4 -4
  21. package/src/__generated__/types.ts +76 -18
  22. package/src/modules/financial-entities/__generated__/admin-businesses.types.ts +60 -0
  23. package/src/modules/financial-entities/__generated__/types.ts +33 -10
  24. package/src/modules/financial-entities/helpers/admin-businesses.helper.ts +33 -0
  25. package/src/modules/financial-entities/providers/admin-businesses.provider.ts +44 -0
  26. package/src/modules/financial-entities/resolvers/admin-businesses.resolver.ts +53 -11
  27. package/src/modules/financial-entities/typeDefs/admin-businesses.graphql.ts +49 -16
  28. 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-20251030164843-d2f490daba879840366288d1f62974ab25081876
3
+ ## 0.0.8-alpha-20251031025517-bd142395bc1d7267ab00d6b53b116062b581b7d8
4
4
 
5
5
  ### Patch Changes
6
6
 
@@ -231,8 +231,17 @@
231
231
  [`@envelop/generic-auth@10.0.1` ↗︎](https://www.npmjs.com/package/@envelop/generic-auth/v/10.0.1)
232
232
  (from `10.0.0`, in `dependencies`)
233
233
 
234
+ - [#2644](https://github.com/Urigo/accounter-fullstack/pull/2644)
235
+ [`7f9f9be`](https://github.com/Urigo/accounter-fullstack/commit/7f9f9be25556b5f66f430a5f660a71ef1b1b3464)
236
+ Thanks [@renovate](https://github.com/apps/renovate)! - dependencies updates:
237
+ - Updated dependency
238
+ [`@ai-sdk/anthropic@2.0.39` ↗︎](https://www.npmjs.com/package/@ai-sdk/anthropic/v/2.0.39) (from
239
+ `2.0.38`, in `dependencies`)
240
+ - Updated dependency [`ai@5.0.82` ↗︎](https://www.npmjs.com/package/ai/v/5.0.82) (from `5.0.81`,
241
+ in `dependencies`)
242
+
234
243
  - [#2646](https://github.com/Urigo/accounter-fullstack/pull/2646)
235
- [`3266908`](https://github.com/Urigo/accounter-fullstack/commit/3266908bd76d58229510147d03f2dd137172abca)
244
+ [`1c8d288`](https://github.com/Urigo/accounter-fullstack/commit/1c8d28840c2c54a3948cd965695e16f84f0fccf2)
236
245
  Thanks [@gilgardosh](https://github.com/gilgardosh)! - dependencies updates:
237
246
  - Updated dependency
238
247
  [`@ai-sdk/anthropic@2.0.39` ↗︎](https://www.npmjs.com/package/@ai-sdk/anthropic/v/2.0.39) (from
@@ -478,6 +487,21 @@
478
487
  streamline the process of adding new businesses, specifically by simplifying the handling of tax
479
488
  category insertions.
480
489
 
490
+ - [#2645](https://github.com/Urigo/accounter-fullstack/pull/2645)
491
+ [`9d8f87a`](https://github.com/Urigo/accounter-fullstack/commit/9d8f87ad54b583964ba731b8478742c09c5600df)
492
+ Thanks [@gilgardosh](https://github.com/gilgardosh)! - - **Database Schema Refactor**: The
493
+ `businesses_admin` table is updated to replace single-value fields for tax and social security
494
+ identifiers with array-based JSONB columns, allowing for multiple annual IDs and historical tax
495
+ rates.
496
+ - **GraphQL Schema Update**: The GraphQL `AdminBusiness` type and related input types
497
+ (`CreateAdminBusinessInput`, `UpdateAdminBusinessInput`) are modified to reflect the new array
498
+ structures, introducing `AnnualId` and `TaxAdvancesRate` types.
499
+ - **Frontend Form Overhaul**: The `admin-business-section.tsx` component is refactored to use
500
+ `react-hook-form`'s `useFieldArray` for dynamic management of annual IDs and tax rates,
501
+ providing a more flexible user interface.
502
+ - **Backend Logic Adaptation**: New Zod schemas and resolver logic are implemented on the server
503
+ to validate and process the updated array-based data for admin business updates.
504
+
481
505
  - [#2640](https://github.com/Urigo/accounter-fullstack/pull/2640)
482
506
  [`26618ff`](https://github.com/Urigo/accounter-fullstack/commit/26618ff2d4a47d63e16ecec59f39887f48df52cf)
483
507
  Thanks [@gilgardosh](https://github.com/gilgardosh)! - - **Renaming and Restructuring**: Key
@@ -493,7 +517,7 @@
493
517
  the new UI structure.
494
518
 
495
519
  - [#2646](https://github.com/Urigo/accounter-fullstack/pull/2646)
496
- [`ea9fe94`](https://github.com/Urigo/accounter-fullstack/commit/ea9fe94330f6315a71eb09553473ec0d576151f2)
520
+ [`1c8d288`](https://github.com/Urigo/accounter-fullstack/commit/1c8d28840c2c54a3948cd965695e16f84f0fccf2)
497
521
  Thanks [@gilgardosh](https://github.com/gilgardosh)! - - **New Contracts Screen**: A dedicated
498
522
  user interface has been introduced for viewing and managing client contracts, accessible via a new
499
523
  sidebar link.
@@ -534,10 +558,10 @@
534
558
  [`65e3c7f`](https://github.com/Urigo/accounter-fullstack/commit/65e3c7f01993eb4f41244a40feefefa08b31a4e6),
535
559
  [`65e3c7f`](https://github.com/Urigo/accounter-fullstack/commit/65e3c7f01993eb4f41244a40feefefa08b31a4e6),
536
560
  [`65e3c7f`](https://github.com/Urigo/accounter-fullstack/commit/65e3c7f01993eb4f41244a40feefefa08b31a4e6)]:
537
- - @accounter/green-invoice-graphql@0.8.2-alpha-20251030164843-d2f490daba879840366288d1f62974ab25081876
538
- - @accounter/pcn874-generator@0.6.3-alpha-20251030164843-d2f490daba879840366288d1f62974ab25081876
539
- - @accounter/shaam-uniform-format-generator@0.2.2-alpha-20251030164843-d2f490daba879840366288d1f62974ab25081876
540
- - @accounter/shaam6111-generator@0.1.4-alpha-20251030164843-d2f490daba879840366288d1f62974ab25081876
561
+ - @accounter/green-invoice-graphql@0.8.2-alpha-20251031025517-bd142395bc1d7267ab00d6b53b116062b581b7d8
562
+ - @accounter/pcn874-generator@0.6.3-alpha-20251031025517-bd142395bc1d7267ab00d6b53b116062b581b7d8
563
+ - @accounter/shaam-uniform-format-generator@0.2.2-alpha-20251031025517-bd142395bc1d7267ab00d6b53b116062b581b7d8
564
+ - @accounter/shaam6111-generator@0.1.4-alpha-20251031025517-bd142395bc1d7267ab00d6b53b116062b581b7d8
541
565
 
542
566
  ## 0.0.7
543
567
 
@@ -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 = {
@@ -3557,6 +3572,17 @@ export type Tag = {
3557
3572
  export type TagInput = {
3558
3573
  readonly id: Scalars['String']['input'];
3559
3574
  };
3575
+ /** Represents the tax advance rate for a specific date. */
3576
+ export type TaxAdvancesRate = {
3577
+ readonly __typename?: 'TaxAdvancesRate';
3578
+ readonly date: Scalars['TimelessDate']['output'];
3579
+ readonly rate: Scalars['Float']['output'];
3580
+ };
3581
+ /** Input type representing the tax advance rate for a specific date. */
3582
+ export type TaxAdvancesRateInput = {
3583
+ readonly date: Scalars['TimelessDate']['input'];
3584
+ readonly rate: Scalars['Float']['input'];
3585
+ };
3560
3586
  /** Tax category entity used for ledger records */
3561
3587
  export type TaxCategory = FinancialEntity & {
3562
3588
  readonly __typename?: 'TaxCategory';
@@ -3671,12 +3697,17 @@ export type Unprocessed = Document & Linkable & {
3671
3697
  };
3672
3698
  /** Input type for updating admin business details. */
3673
3699
  export type UpdateAdminBusinessInput = {
3700
+ readonly governmentId?: InputMaybe<Scalars['String']['input']>;
3701
+ readonly name?: InputMaybe<Scalars['String']['input']>;
3674
3702
  readonly registrationDate?: InputMaybe<Scalars['TimelessDate']['input']>;
3675
- readonly socialSecurityEmployerId?: InputMaybe<Scalars['String']['input']>;
3676
- readonly taxAdvancesId?: InputMaybe<Scalars['String']['input']>;
3677
- readonly taxAdvancesRate?: InputMaybe<Scalars['Float']['input']>;
3678
- readonly withholdingTaxBookNumber?: InputMaybe<Scalars['String']['input']>;
3679
- readonly withholdingTaxFileNumber?: InputMaybe<Scalars['String']['input']>;
3703
+ /** Social Security Info */
3704
+ readonly socialSecurityEmployerIds?: InputMaybe<ReadonlyArray<AnnualIdInput>>;
3705
+ /** Tax Advances Info */
3706
+ readonly taxAdvancesAnnualIds?: InputMaybe<ReadonlyArray<AnnualIdInput>>;
3707
+ readonly taxAdvancesRates?: InputMaybe<ReadonlyArray<TaxAdvancesRateInput>>;
3708
+ readonly withholdingTaxAnnualIds?: InputMaybe<ReadonlyArray<AnnualIdInput>>;
3709
+ /** Withholding Tax Info */
3710
+ readonly withholdingTaxCompanyId?: InputMaybe<Scalars['String']['input']>;
3680
3711
  };
3681
3712
  /** input for updateBusiness */
3682
3713
  export type UpdateBusinessInput = {
@@ -4108,6 +4139,8 @@ export type ResolversTypes = {
4108
4139
  AdminBusiness: ResolverTypeWrapper<IGetAllAdminBusinessesResult>;
4109
4140
  AdminContext: ResolverTypeWrapper<IGetAdminContextsResult>;
4110
4141
  AdminContextInput: AdminContextInput;
4142
+ AnnualId: ResolverTypeWrapper<AnnualId>;
4143
+ AnnualIdInput: AnnualIdInput;
4111
4144
  AuditOpinionType: AuditOpinionType;
4112
4145
  BalanceTransactions: ResolverTypeWrapper<IGetNormalizedBalanceTransactionsResult>;
4113
4146
  BankDeposit: ResolverTypeWrapper<Omit<BankDeposit, 'transactions'> & {
@@ -4377,6 +4410,8 @@ export type ResolversTypes = {
4377
4410
  SuggestionsInput: SuggestionsInput;
4378
4411
  Tag: ResolverTypeWrapper<IGetAllTagsResult>;
4379
4412
  TagInput: TagInput;
4413
+ TaxAdvancesRate: ResolverTypeWrapper<TaxAdvancesRate>;
4414
+ TaxAdvancesRateInput: TaxAdvancesRateInput;
4380
4415
  TaxCategory: ResolverTypeWrapper<IGetAllTaxCategoriesResult>;
4381
4416
  TaxReport: ResolverTypeWrapper<Omit<TaxReport, 'reference' | 'report'> & {
4382
4417
  reference: ReadonlyArray<ResolversTypes['TaxReportYear']>;
@@ -4475,6 +4510,8 @@ export type ResolversParentTypes = {
4475
4510
  AdminBusiness: IGetAllAdminBusinessesResult;
4476
4511
  AdminContext: IGetAdminContextsResult;
4477
4512
  AdminContextInput: AdminContextInput;
4513
+ AnnualId: AnnualId;
4514
+ AnnualIdInput: AnnualIdInput;
4478
4515
  BalanceTransactions: IGetNormalizedBalanceTransactionsResult;
4479
4516
  BankDeposit: Omit<BankDeposit, 'transactions'> & {
4480
4517
  transactions: ReadonlyArray<ResolversParentTypes['Transaction']>;
@@ -4709,6 +4746,8 @@ export type ResolversParentTypes = {
4709
4746
  SuggestionsInput: SuggestionsInput;
4710
4747
  Tag: IGetAllTagsResult;
4711
4748
  TagInput: TagInput;
4749
+ TaxAdvancesRate: TaxAdvancesRate;
4750
+ TaxAdvancesRateInput: TaxAdvancesRateInput;
4712
4751
  TaxCategory: IGetAllTaxCategoriesResult;
4713
4752
  TaxReport: Omit<TaxReport, 'reference' | 'report'> & {
4714
4753
  reference: ReadonlyArray<ResolversParentTypes['TaxReportYear']>;
@@ -4810,11 +4849,12 @@ export type AdminBusinessResolvers<ContextType = GraphQLModules.Context, ParentT
4810
4849
  id?: Resolver<ResolversTypes['UUID'], ParentType, ContextType>;
4811
4850
  name?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
4812
4851
  registrationDate?: Resolver<ResolversTypes['TimelessDate'], ParentType, ContextType>;
4813
- socialSecurityEmployerId?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
4814
- taxAdvancesId?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
4815
- taxAdvancesRate?: Resolver<Maybe<ResolversTypes['Float']>, ParentType, ContextType>;
4816
- withholdingTaxBookNumber?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
4817
- withholdingTaxFileNumber?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
4852
+ socialSecurityDeductionsId?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
4853
+ socialSecurityEmployerIds?: Resolver<ReadonlyArray<ResolversTypes['AnnualId']>, ParentType, ContextType>;
4854
+ taxAdvancesAnnualIds?: Resolver<ReadonlyArray<ResolversTypes['AnnualId']>, ParentType, ContextType>;
4855
+ taxAdvancesRates?: Resolver<ReadonlyArray<ResolversTypes['TaxAdvancesRate']>, ParentType, ContextType>;
4856
+ withholdingTaxAnnualIds?: Resolver<ReadonlyArray<ResolversTypes['AnnualId']>, ParentType, ContextType>;
4857
+ withholdingTaxCompanyId?: Resolver<Maybe<ResolversTypes['String']>, ParentType, ContextType>;
4818
4858
  __isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
4819
4859
  };
4820
4860
  export type AdminContextResolvers<ContextType = GraphQLModules.Context, ParentType extends ResolversParentTypes['AdminContext'] = ResolversParentTypes['AdminContext']> = {
@@ -4883,6 +4923,11 @@ export type AdminContextResolvers<ContextType = GraphQLModules.Context, ParentTy
4883
4923
  zkufotIncomeTaxCategory?: Resolver<Maybe<ResolversTypes['TaxCategory']>, ParentType, ContextType>;
4884
4924
  __isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
4885
4925
  };
4926
+ export type AnnualIdResolvers<ContextType = GraphQLModules.Context, ParentType extends ResolversParentTypes['AnnualId'] = ResolversParentTypes['AnnualId']> = {
4927
+ id?: Resolver<ResolversTypes['String'], ParentType, ContextType>;
4928
+ year?: Resolver<ResolversTypes['Int'], ParentType, ContextType>;
4929
+ __isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
4930
+ };
4886
4931
  export type BalanceTransactionsResolvers<ContextType = GraphQLModules.Context, ParentType extends ResolversParentTypes['BalanceTransactions'] = ResolversParentTypes['BalanceTransactions']> = {
4887
4932
  amount?: Resolver<ResolversTypes['FinancialAmount'], ParentType, ContextType>;
4888
4933
  amountUsd?: Resolver<ResolversTypes['FinancialAmount'], ParentType, ContextType>;
@@ -6680,6 +6725,11 @@ export type TagResolvers<ContextType = GraphQLModules.Context, ParentType extend
6680
6725
  parent?: Resolver<Maybe<ResolversTypes['Tag']>, ParentType, ContextType>;
6681
6726
  __isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
6682
6727
  };
6728
+ export type TaxAdvancesRateResolvers<ContextType = GraphQLModules.Context, ParentType extends ResolversParentTypes['TaxAdvancesRate'] = ResolversParentTypes['TaxAdvancesRate']> = {
6729
+ date?: Resolver<ResolversTypes['TimelessDate'], ParentType, ContextType>;
6730
+ rate?: Resolver<ResolversTypes['Float'], ParentType, ContextType>;
6731
+ __isTypeOf?: IsTypeOfResolverFn<ParentType, ContextType>;
6732
+ };
6683
6733
  export type TaxCategoryResolvers<ContextType = GraphQLModules.Context, ParentType extends ResolversParentTypes['TaxCategory'] = ResolversParentTypes['TaxCategory']> = {
6684
6734
  createdAt?: Resolver<ResolversTypes['DateTime'], ParentType, ContextType>;
6685
6735
  id?: Resolver<ResolversTypes['UUID'], ParentType, ContextType>;
@@ -6912,6 +6962,7 @@ export type YearlyLedgerReportFinancialEntityInfoResolvers<ContextType = GraphQL
6912
6962
  export type Resolvers<ContextType = GraphQLModules.Context> = {
6913
6963
  AdminBusiness?: AdminBusinessResolvers<ContextType>;
6914
6964
  AdminContext?: AdminContextResolvers<ContextType>;
6965
+ AnnualId?: AnnualIdResolvers<ContextType>;
6915
6966
  BalanceTransactions?: BalanceTransactionsResolvers<ContextType>;
6916
6967
  BankDeposit?: BankDepositResolvers<ContextType>;
6917
6968
  BankDepositCharge?: BankDepositChargeResolvers<ContextType>;
@@ -7057,6 +7108,7 @@ export type Resolvers<ContextType = GraphQLModules.Context> = {
7057
7108
  Suggestions?: SuggestionsResolvers<ContextType>;
7058
7109
  SuggestionsEmailListenerConfig?: SuggestionsEmailListenerConfigResolvers<ContextType>;
7059
7110
  Tag?: TagResolvers<ContextType>;
7111
+ TaxAdvancesRate?: TaxAdvancesRateResolvers<ContextType>;
7060
7112
  TaxCategory?: TaxCategoryResolvers<ContextType>;
7061
7113
  TaxReport?: TaxReportResolvers<ContextType>;
7062
7114
  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;AAi5D7B,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;AA85D7B,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,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vD,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":["../../../../../../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;AAOnD,MAAM,uBAAuB,GAAG,GAAG,CAA+B;;;;;;;0BAOxC,CAAC;AAE3B,MAAM,qBAAqB,GAAG,GAAG,CAA6B;;;;;;;;kBAQ5C,CAAC;AAMZ,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAKd;IAJpB,KAAK,GAAG,gBAAgB,CAAC;QACvB,MAAM,EAAE,EAAE,GAA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AC;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,CAAC;AAEnB,MAAM,qBAAqB,GAAG,GAAG,CAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA6B7C,CAAC;AAMX,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAKd;IAJpB,KAAK,GAAG,gBAAgB,CAAC;QACvB,MAAM,EAAE,EAAE,GAAG,CAAC;KACf,CAAC,CAAC;IAEH,YAAoB,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;IAAG,CAAC;IAEtC,KAAK,CAAC,yBAAyB,CAAC,GAAsB;QAC5D,MAAM,SAAS,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;QACpC,MAAM,eAAe,GAAG,MAAM,uBAAuB,CAAC,GAAG,CACvD;YACE,GAAG,EAAE,SAAS;SACf,EACD,IAAI,CAAC,UAAU,CAChB,CAAC;QACF,OAAO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