Skip to content

Conversation

@ashwin1111
Copy link
Contributor

@ashwin1111 ashwin1111 commented Dec 11, 2024

Description

Please add PR description here, add screenshots if needed

Clickup

https://app.clickup.com/

Summary by CodeRabbit

  • New Features

    • Enhanced flexibility for the status__in parameter to accept multiple status values.
    • Updated onboarding routes for QBD Direct integration.
    • Added toast notifications for user feedback in the QbdDirectMainComponent.
  • Bug Fixes

    • Corrected typographical errors in method names across multiple components.
  • Improvements

    • Expanded logic for handling export statuses in various services.
    • Clarified version handling in the import expenses method.
    • Integrated new services to enhance data import functionality in QBD Direct.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 11, 2024

Walkthrough

The pull request introduces several modifications across multiple files. Key changes include updating the ExpenseGroupParam type to allow the status__in property to accept either a string or an array of strings. Additionally, the QbdDirectOnboardingModel class has updated route paths for onboarding steps. The AccountingExportService and ExportLogService classes have revised logic for handling the status__in parameter, expanding the conditions for status retrieval. Minor corrections, such as renaming a variable in the NetsuiteMainComponent, are also included.

Changes

File Path Change Summary
src/app/core/models/db/expense-group.model.ts Updated ExpenseGroupParam type: status__in changed from string to `string
src/app/core/models/qbd-direct/qbd-direct-configuration/qbd-direct-onboarding.model.ts Updated routing paths for onboarding steps from /integrations/qbo/onboarding/ to /integrations/qbd_direct/onboarding/.
src/app/core/services/common/accounting-export.service.ts Modified getAccountingExports to include both AccountingExportStatus.ERROR and AccountingExportStatus.FATAL for status__in. Updated importExpensesFromFyle to accept a version parameter (`'v1'
src/app/core/services/common/export-log.service.ts Updated getExpenseGroups method to set params.status__in to an array containing AccountingExportStatus.ERROR and AccountingExportStatus.FATAL for AppName.QBD_DIRECT.
src/app/integrations/netsuite/netsuite-main/netsuite-main.component.ts Renamed private variable toastServeice to toastService. Updated method call to displayToastMessage.
src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-main.component.ts Added imports for ToastSeverity and IntegrationsToastService. Updated constructor to include IntegrationsToastService. Enhanced refreshDimensions method to call importAttributes from QbdDirectHelperService.
src/app/core/services/qbd-direct/qbd-direct-core/qbd-direct-helper.service.ts Corrected method name from importAttribuites to importAttributes.
src/app/integrations/qbd-direct/qbd-direct-shared/qbd-direct-advanced-settings/qbd-direct-advanced-settings.component.ts Corrected method call from importAttribuites to importAttributes in refreshDimensions.
src/app/integrations/qbd-direct/qbd-direct-shared/qbd-direct-export-settings/qbd-direct-export-settings.component.ts Corrected method call from importAttribuites to importAttributes in refreshDimensions.
src/app/integrations/qbd-direct/qbd-direct-shared/qbd-direct-import-settings/qbd-direct-import-settings.component.ts Corrected method call from importAttribuites to importAttributes in refreshDimensions.

Possibly related PRs

Suggested labels

deploy, size/M

Suggested reviewers

  • DhaaraniCIT

🐇 "In the code, we hop and play,
With types and routes, we pave the way.
From strings to arrays, we make it right,
Toasts and updates, oh what a sight!
With every change, our work's a treat,
Hopping along, we can't be beat!" 🐇


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Experiment)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the size/S Small PR label Dec 11, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-main.component.ts (1)

51-52: Enhanced user feedback for QBD sync operation

Good addition of QBD attributes import and user feedback via toast notification. Consider adding error handling for the subscription.

-    this.qbdDirectHelperService.importQBDAttributes(true).subscribe();
+    this.qbdDirectHelperService.importQBDAttributes(true).subscribe({
+      error: (error) => {
+        this.toastService.displayToastMessage(ToastSeverity.ERROR, 'Failed to sync QBD dimensions');
+        console.error('QBD sync error:', error);
+      }
+    });
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between b627967 and 92a6740.

📒 Files selected for processing (6)
  • src/app/core/models/db/expense-group.model.ts (1 hunks)
  • src/app/core/models/qbd-direct/qbd-direct-configuration/qbd-direct-onboarding.model.ts (1 hunks)
  • src/app/core/services/common/accounting-export.service.ts (1 hunks)
  • src/app/core/services/common/export-log.service.ts (1 hunks)
  • src/app/integrations/netsuite/netsuite-main/netsuite-main.component.ts (1 hunks)
  • src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-main.component.ts (3 hunks)
🔇 Additional comments (8)
src/app/core/models/db/expense-group.model.ts (1)

35-35: LGTM: Type enhancement improves flexibility

The change from string to string | string[] allows for more flexible status filtering while maintaining backward compatibility. This enhancement supports querying multiple statuses, which is particularly useful for QBD's error handling requirements.

src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-main.component.ts (2)

6-10: LGTM: Clean import organization

The new imports are properly organized and follow Angular's best practices.


37-40: LGTM: Proper dependency injection

The new services are correctly injected following Angular's dependency injection pattern.

src/app/integrations/netsuite/netsuite-main/netsuite-main.component.ts (1)

36-36: LGTM: Fixed service name typo

Corrected the typo in the service name from 'toastServeice' to 'toastService', maintaining consistency across components.

Also applies to: 43-43

src/app/core/models/qbd-direct/qbd-direct-configuration/qbd-direct-onboarding.model.ts (1)

29-29: Route paths updated from QBO to QBD Direct

The route paths have been correctly updated from /integrations/qbo/onboarding/ to /integrations/qbd_direct/onboarding/ across all onboarding steps.

Let's verify no QBO routes remain in the codebase for QBD:

Also applies to: 37-37, 45-45, 53-53, 61-61

✅ Verification successful

Let me analyze the search results. The output shows that QBO (QuickBooks Online) routes are present in their own dedicated module and components under src/app/integrations/qbo/. These routes are correctly separated from the QBD (QuickBooks Desktop) routes that were updated in the review. The QBO routes found in the search results are legitimate and expected since they belong to a different integration module.

No incorrect QBO routes found in QBD Direct module

The route path changes from /integrations/qbo/onboarding/ to /integrations/qbd_direct/onboarding/ in the QBD Direct module are correct and do not conflict with the existing QBO routes. Each integration module maintains its own separate routing structure.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any remaining QBO routes that might be related to QBD
rg -i "qbo.*onboarding" --type ts

Length of output: 41942

src/app/core/services/common/export-log.service.ts (1)

89-89: Status mapping expanded to include FATAL errors

The status mapping for QBD Direct now correctly handles both ERROR and FATAL statuses when FAILED status is encountered. This change aligns with the error handling in AccountingExportService.

Let's verify the consistency of status handling across the codebase:

✅ Verification successful

The search results show consistent handling of FAILED and FATAL statuses across the codebase. The pattern of replacing FAILED with [ERROR, FATAL] is consistently implemented in both ExportLogService and AccountingExportService. Additionally, other components like Sage300Dashboard and BusinessCentralDashboard correctly handle both FAILED and FATAL statuses in their filtering logic.

Status handling is consistent across the codebase

The change in ExportLogService aligns with the existing error status handling patterns throughout the codebase, where FAILED and FATAL statuses are handled together in filtering and processing logic.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for other instances of ERROR or FATAL status handling
rg "AccountingExportStatus\.(ERROR|FATAL|FAILED)" --type ts

Length of output: 3403

src/app/core/services/common/accounting-export.service.ts (2)

76-76: Status mapping aligned with ExportLogService

The status mapping for QBD Direct now correctly handles both ERROR and FATAL statuses when FAILED status is encountered, maintaining consistency with ExportLogService.


78-78: Verify removal of type__in parameter

The type__in parameter is being removed for QBD Direct requests. Please confirm if QBD Direct export logs don't require type filtering.

Let's check if type filtering is used elsewhere for QBD Direct:

✅ Verification successful

Based on the code context found, I can now provide a final response:

Type filtering is intentionally removed for QBD Direct export logs

The code explicitly removes type filtering (type__in) for QBD Direct export logs by design. This is handled in the getAccountingExports method where there's a specific condition for QBD Direct that removes the type filter and uses a different API endpoint (/export_logs/) compared to other integrations. This indicates that type filtering is not required for QBD Direct export logs as they are handled differently from other accounting exports.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for type filtering in QBD Direct related code
rg "type__in.*QBD" --type ts

Length of output: 30


Script:

#!/bin/bash
# Let's search for any usage of type__in in the codebase
rg "type__in" --type ts -B 2 -A 2

# Also search for QBD related export code
rg "QBD.*export" --type ts -B 2 -A 2

Length of output: 26086


Script:

#!/bin/bash
# Let's search for QBD Direct export logs related code to understand the type filtering
rg "QBD.*Direct.*export.*log" --type ts -B 3 -A 3

# Also search for any QBD Direct specific type filtering
rg "type.*filter.*QBD.*Direct" --type ts -B 3 -A 3

Length of output: 104


Script:

#!/bin/bash
# Let's look at the context around where type__in is being deleted
rg -B 10 -A 10 "delete apiParams.type__in" --type ts

# Also check for any QBD Direct specific export log related code
rg "QBDDirect.*export" --type ts -B 3 -A 3

Length of output: 1996

🧰 Tools
🪛 Biome (1.9.4)

[error] 78-78: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


refreshDimensions() {
this.workspaceService.importFyleAttributes(true).subscribe();
this.qbdDirectHelperService.importQBDAttributes(true).subscribe();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have a helper service for this, @ashwin1111 we can use them

@github-actions
Copy link

Unit Test Coverage % values
Statements 34.03% ( 4197 / 12331 )
Branches 27.68% ( 1208 / 4363 )
Functions 26.66% ( 921 / 3454 )
Lines 34.19% ( 4129 / 12075 )

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
src/app/core/services/qbd-direct/qbd-direct-core/qbd-direct-helper.service.ts (1)

Line range hint 23-27: Add error handling and improve subscription management

While the method name correction is good, there are some improvements needed in the implementation:

  1. Add error handling for API calls
  2. Show success message only after both operations complete
  3. Properly manage subscriptions to prevent memory leaks

Here's a suggested implementation using RxJS operators:

- importAttributes(refresh: boolean): void {
-   this.workspaceService.importFyleAttributes(refresh).subscribe();
-   this.importQBDAttributes(refresh).subscribe();
-   this.toastService.displayToastMessage(ToastSeverity.SUCCESS, 'Syncing data dimensions from Quickbooks Desktop');
- }
+ importAttributes(refresh: boolean): void {
+   forkJoin([
+     this.workspaceService.importFyleAttributes(refresh),
+     this.importQBDAttributes(refresh)
+   ]).pipe(
+     take(1)
+   ).subscribe({
+     next: () => {
+       this.toastService.displayToastMessage(ToastSeverity.SUCCESS, 'Successfully synced data dimensions from Quickbooks Desktop');
+     },
+     error: () => {
+       this.toastService.displayToastMessage(ToastSeverity.ERROR, 'Failed to sync data dimensions from Quickbooks Desktop');
+     }
+   });
+ }

Don't forget to add these imports:

import { forkJoin, take } from 'rxjs';
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 92a6740 and bb50ba2.

📒 Files selected for processing (5)
  • src/app/core/services/qbd-direct/qbd-direct-core/qbd-direct-helper.service.ts (1 hunks)
  • src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-main.component.ts (3 hunks)
  • src/app/integrations/qbd-direct/qbd-direct-shared/qbd-direct-advanced-settings/qbd-direct-advanced-settings.component.ts (1 hunks)
  • src/app/integrations/qbd-direct/qbd-direct-shared/qbd-direct-export-settings/qbd-direct-export-settings.component.ts (1 hunks)
  • src/app/integrations/qbd-direct/qbd-direct-shared/qbd-direct-import-settings/qbd-direct-import-settings.component.ts (1 hunks)
✅ Files skipped from review due to trivial changes (3)
  • src/app/integrations/qbd-direct/qbd-direct-shared/qbd-direct-export-settings/qbd-direct-export-settings.component.ts
  • src/app/integrations/qbd-direct/qbd-direct-shared/qbd-direct-import-settings/qbd-direct-import-settings.component.ts
  • src/app/integrations/qbd-direct/qbd-direct-shared/qbd-direct-advanced-settings/qbd-direct-advanced-settings.component.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/app/integrations/qbd-direct/qbd-direct-main/qbd-direct-main.component.ts

@ashwin1111 ashwin1111 merged commit 984aacb into master Dec 11, 2024
5 checks passed
ashwin1111 added a commit that referenced this pull request Dec 11, 2024
* fix: QBD fixes post testing

* fix
@coderabbitai coderabbitai bot mentioned this pull request Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Small PR

Development

Successfully merging this pull request may close these issues.

2 participants