Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API & backend to create customer in wingback #4868

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from
Draft

Conversation

hero101
Copy link
Collaborator

@hero101 hero101 commented Jan 24, 2025

Summary by CodeRabbit

Release Notes

  • New Features

    • Added Wingback account creation functionality for managing external subscriptions
    • Introduced new methods for retrieving and updating account details
  • Improvements

    • Enhanced error handling for external service interactions
    • Expanded type definitions to support more flexible data management
  • New Exceptions

    • Added custom exceptions for Wingback service interactions, including customer creation and removal errors

The updates focus on improving account management and external subscription capabilities with more robust error handling and type support.

Copy link
Contributor

coderabbitai bot commented Jan 24, 2025

Warning

Rate limit exceeded

@hero101 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 17 minutes and 3 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between a62319d and 62780d2.

📒 Files selected for processing (1)
  • src/domain/space/account/account.service.ts (2 hunks)

Walkthrough

This pull request introduces comprehensive changes to the Wingback subscription service integration, focusing on customer management, error handling, and account-related functionality. The modifications span multiple files across the project, introducing new methods for creating and managing Wingback customer accounts, defining new exception types, and updating type definitions to support more flexible error handling and customer creation processes.

Changes

File Path Change Summary
src/common/exceptions/exception.details.ts Updated originalException type to allow unknown values
src/domain/space/account/account.service.license.ts Added createWingbackAccount method for creating Wingback accounts
src/domain/space/account/account.service.ts Added methods updateExternalSubscriptionId and getAccountAndDetails
src/platform/admin/licensing/admin.licensing.resolver.mutations.ts Added createWingbackAccount mutation method
src/platform/licensing/wingback-subscription/* Renamed CreateCustomer to CreateWingbackCustomer and updated related types
src/services/external/wingback/exceptions/* Introduced new exception classes for Wingback-specific error scenarios
src/services/external/wingback/wingback.manager.ts Enhanced customer management methods with improved error handling

Sequence Diagram

sequenceDiagram
    participant Admin
    participant AdminLicensingResolver
    participant AccountService
    participant AccountLicenseService
    participant WingbackManager

    Admin->>AdminLicensingResolver: createWingbackAccount(accountID)
    AdminLicensingResolver->>AccountService: getAccountOrFail(accountID)
    AccountService-->>AdminLicensingResolver: Account Details
    AdminLicensingResolver->>AccountLicenseService: createWingbackAccount(accountID)
    AccountLicenseService->>AccountService: getAccountAndDetails(accountID)
    AccountService-->>AccountLicenseService: Account Details
    AccountLicenseService->>WingbackManager: createCustomer(customerData)
    WingbackManager-->>AccountLicenseService: Customer ID
    AccountLicenseService->>AccountService: updateExternalSubscriptionId
    AccountLicenseService-->>AdminLicensingResolver: Wingback Customer ID
Loading

Possibly related PRs


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. (Beta)
  • @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.

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.

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: 2

🧹 Nitpick comments (7)
src/services/external/wingback/wingback.manager.ts (3)

60-77: Consider throwing a more specific exception for disabled service.
Replacing Error('Wingback is not enabled') with a custom WingbackDisabledException consistently aligns with the specialized error handling approach.

- throw new Error('Wingback is not enabled');
+ throw new WingbackDisabledException('Wingback is not enabled', LogContext.WINGBACK);

79-105: Assess concurrency aspect when removing a customer.
Consider verifying the customer's status post-removal or handling multiple remove calls simultaneously.


238-243: Confirm DELETE request body support.
If Wingback’s API disallows sending data with DELETE, removing the data parameter could simplify usage.

src/platform/licensing/wingback-subscription/types/create.customer.input.ts (1)

1-13: Clear and well-documented structure.
Adding a usage example or elaborating how Wingback consumes these fields might further improve clarity.

src/services/external/wingback/exceptions/wingback.customer.not.found.ts (1)

5-13: Optionally add a doc comment
A brief doc comment explaining when and why this exception is thrown can help future contributors quickly grasp its usage.

src/services/external/wingback/exceptions/wingback.exception.ts (1)

6-20: Consider adding explicit naming or docstrings
Providing a short doc comment and a distinct name property could make this exception more recognizable in stack traces and logs.

+/**
+ * This exception is thrown for Wingback-specific errors,
+ * capturing additional details such as status, URL, and method.
+ */
 export class WingbackException extends BaseExceptionInternal {
     ...
 }
src/domain/space/account/account.service.license.ts (1)

78-113: New Wingback account creation logic
The flow for creating a Wingback account is comprehensive: it checks for existing data, throws appropriate exceptions, and updates the external subscription ID. Consider a transaction if the partial success state (Wingback created but local update fails) is problematic.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ce4ee76 and a62319d.

📒 Files selected for processing (13)
  • src/common/exceptions/exception.details.ts (1 hunks)
  • src/domain/space/account/account.service.license.ts (3 hunks)
  • src/domain/space/account/account.service.ts (2 hunks)
  • src/platform/admin/licensing/admin.licensing.resolver.mutations.ts (2 hunks)
  • src/platform/licensing/wingback-subscription/licensing.wingback.subscription.service.ts (2 hunks)
  • src/platform/licensing/wingback-subscription/types/create.customer.input.ts (1 hunks)
  • src/services/external/wingback/exceptions/wingback.customer.not.created.ts (1 hunks)
  • src/services/external/wingback/exceptions/wingback.customer.not.found.ts (1 hunks)
  • src/services/external/wingback/exceptions/wingback.customer.not.removed.ts (1 hunks)
  • src/services/external/wingback/exceptions/wingback.exception.ts (1 hunks)
  • src/services/external/wingback/types/wingback.type.create.customer.ts (2 hunks)
  • src/services/external/wingback/types/wingback.type.error.ts (1 hunks)
  • src/services/external/wingback/wingback.manager.ts (7 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src/services/external/wingback/types/wingback.type.error.ts
🧰 Additional context used
📓 Path-based instructions (12)
src/common/exceptions/exception.details.ts (1)

Pattern src/**/*.{ts,js}: Review the TypeScript/JavaScript code for NestJS best practices, dependency injection, module structure, and potential bugs.

Context Files (Do Not Review):

  • docs/Design.md - Design overview of the project
  • docs/Pagination.md - Pagination design overview
  • docs/Developing.md - Development setup overview
  • docs/graphql-typeorm-usage.md - overview of GraphQL and TypeORM usage and how they are used together with NestJS in the project
  • docs/database-definitions.md - guidelines for creating TypeORM entity defnitions
  • src/core/error-handling/graphql.exception.filter.ts - GraphQL error handling
  • src/core/error-handling/http.exception.filter.ts - HTTP error handling
  • src/core/error-handling/rest.error.response.ts - REST error response
  • src/core/error-handling/unhandled.exception.filter.ts - Global exception handler

Guidelines:

  • Our project uses global exception handlers (UnhandledExceptionFilter), so avoid suggesting additional try/catch blocks unless handling specific cases.
  • Use NestJS latest documentation from https://docs.nestjs.com/ for reference on NestJS best practices.
  • Use TypeORM latest documentation from https://typeorm.io/ for reference on TypeORM best practices.
  • Refer to the design overview in the context files for better understanding.
src/platform/licensing/wingback-subscription/types/create.customer.input.ts (1)

Pattern src/**/*.{ts,js}: Review the TypeScript/JavaScript code for NestJS best practices, dependency injection, module structure, and potential bugs.

Context Files (Do Not Review):

  • docs/Design.md - Design overview of the project
  • docs/Pagination.md - Pagination design overview
  • docs/Developing.md - Development setup overview
  • docs/graphql-typeorm-usage.md - overview of GraphQL and TypeORM usage and how they are used together with NestJS in the project
  • docs/database-definitions.md - guidelines for creating TypeORM entity defnitions
  • src/core/error-handling/graphql.exception.filter.ts - GraphQL error handling
  • src/core/error-handling/http.exception.filter.ts - HTTP error handling
  • src/core/error-handling/rest.error.response.ts - REST error response
  • src/core/error-handling/unhandled.exception.filter.ts - Global exception handler

Guidelines:

  • Our project uses global exception handlers (UnhandledExceptionFilter), so avoid suggesting additional try/catch blocks unless handling specific cases.
  • Use NestJS latest documentation from https://docs.nestjs.com/ for reference on NestJS best practices.
  • Use TypeORM latest documentation from https://typeorm.io/ for reference on TypeORM best practices.
  • Refer to the design overview in the context files for better understanding.
src/services/external/wingback/exceptions/wingback.customer.not.removed.ts (1)

Pattern src/**/*.{ts,js}: Review the TypeScript/JavaScript code for NestJS best practices, dependency injection, module structure, and potential bugs.

Context Files (Do Not Review):

  • docs/Design.md - Design overview of the project
  • docs/Pagination.md - Pagination design overview
  • docs/Developing.md - Development setup overview
  • docs/graphql-typeorm-usage.md - overview of GraphQL and TypeORM usage and how they are used together with NestJS in the project
  • docs/database-definitions.md - guidelines for creating TypeORM entity defnitions
  • src/core/error-handling/graphql.exception.filter.ts - GraphQL error handling
  • src/core/error-handling/http.exception.filter.ts - HTTP error handling
  • src/core/error-handling/rest.error.response.ts - REST error response
  • src/core/error-handling/unhandled.exception.filter.ts - Global exception handler

Guidelines:

  • Our project uses global exception handlers (UnhandledExceptionFilter), so avoid suggesting additional try/catch blocks unless handling specific cases.
  • Use NestJS latest documentation from https://docs.nestjs.com/ for reference on NestJS best practices.
  • Use TypeORM latest documentation from https://typeorm.io/ for reference on TypeORM best practices.
  • Refer to the design overview in the context files for better understanding.
src/domain/space/account/account.service.license.ts (1)

Pattern src/**/*.{ts,js}: Review the TypeScript/JavaScript code for NestJS best practices, dependency injection, module structure, and potential bugs.

Context Files (Do Not Review):

  • docs/Design.md - Design overview of the project
  • docs/Pagination.md - Pagination design overview
  • docs/Developing.md - Development setup overview
  • docs/graphql-typeorm-usage.md - overview of GraphQL and TypeORM usage and how they are used together with NestJS in the project
  • docs/database-definitions.md - guidelines for creating TypeORM entity defnitions
  • src/core/error-handling/graphql.exception.filter.ts - GraphQL error handling
  • src/core/error-handling/http.exception.filter.ts - HTTP error handling
  • src/core/error-handling/rest.error.response.ts - REST error response
  • src/core/error-handling/unhandled.exception.filter.ts - Global exception handler

Guidelines:

  • Our project uses global exception handlers (UnhandledExceptionFilter), so avoid suggesting additional try/catch blocks unless handling specific cases.
  • Use NestJS latest documentation from https://docs.nestjs.com/ for reference on NestJS best practices.
  • Use TypeORM latest documentation from https://typeorm.io/ for reference on TypeORM best practices.
  • Refer to the design overview in the context files for better understanding.
src/services/external/wingback/exceptions/wingback.customer.not.found.ts (1)

Pattern src/**/*.{ts,js}: Review the TypeScript/JavaScript code for NestJS best practices, dependency injection, module structure, and potential bugs.

Context Files (Do Not Review):

  • docs/Design.md - Design overview of the project
  • docs/Pagination.md - Pagination design overview
  • docs/Developing.md - Development setup overview
  • docs/graphql-typeorm-usage.md - overview of GraphQL and TypeORM usage and how they are used together with NestJS in the project
  • docs/database-definitions.md - guidelines for creating TypeORM entity defnitions
  • src/core/error-handling/graphql.exception.filter.ts - GraphQL error handling
  • src/core/error-handling/http.exception.filter.ts - HTTP error handling
  • src/core/error-handling/rest.error.response.ts - REST error response
  • src/core/error-handling/unhandled.exception.filter.ts - Global exception handler

Guidelines:

  • Our project uses global exception handlers (UnhandledExceptionFilter), so avoid suggesting additional try/catch blocks unless handling specific cases.
  • Use NestJS latest documentation from https://docs.nestjs.com/ for reference on NestJS best practices.
  • Use TypeORM latest documentation from https://typeorm.io/ for reference on TypeORM best practices.
  • Refer to the design overview in the context files for better understanding.
src/services/external/wingback/exceptions/wingback.exception.ts (1)

Pattern src/**/*.{ts,js}: Review the TypeScript/JavaScript code for NestJS best practices, dependency injection, module structure, and potential bugs.

Context Files (Do Not Review):

  • docs/Design.md - Design overview of the project
  • docs/Pagination.md - Pagination design overview
  • docs/Developing.md - Development setup overview
  • docs/graphql-typeorm-usage.md - overview of GraphQL and TypeORM usage and how they are used together with NestJS in the project
  • docs/database-definitions.md - guidelines for creating TypeORM entity defnitions
  • src/core/error-handling/graphql.exception.filter.ts - GraphQL error handling
  • src/core/error-handling/http.exception.filter.ts - HTTP error handling
  • src/core/error-handling/rest.error.response.ts - REST error response
  • src/core/error-handling/unhandled.exception.filter.ts - Global exception handler

Guidelines:

  • Our project uses global exception handlers (UnhandledExceptionFilter), so avoid suggesting additional try/catch blocks unless handling specific cases.
  • Use NestJS latest documentation from https://docs.nestjs.com/ for reference on NestJS best practices.
  • Use TypeORM latest documentation from https://typeorm.io/ for reference on TypeORM best practices.
  • Refer to the design overview in the context files for better understanding.
src/services/external/wingback/types/wingback.type.create.customer.ts (1)

Pattern src/**/*.{ts,js}: Review the TypeScript/JavaScript code for NestJS best practices, dependency injection, module structure, and potential bugs.

Context Files (Do Not Review):

  • docs/Design.md - Design overview of the project
  • docs/Pagination.md - Pagination design overview
  • docs/Developing.md - Development setup overview
  • docs/graphql-typeorm-usage.md - overview of GraphQL and TypeORM usage and how they are used together with NestJS in the project
  • docs/database-definitions.md - guidelines for creating TypeORM entity defnitions
  • src/core/error-handling/graphql.exception.filter.ts - GraphQL error handling
  • src/core/error-handling/http.exception.filter.ts - HTTP error handling
  • src/core/error-handling/rest.error.response.ts - REST error response
  • src/core/error-handling/unhandled.exception.filter.ts - Global exception handler

Guidelines:

  • Our project uses global exception handlers (UnhandledExceptionFilter), so avoid suggesting additional try/catch blocks unless handling specific cases.
  • Use NestJS latest documentation from https://docs.nestjs.com/ for reference on NestJS best practices.
  • Use TypeORM latest documentation from https://typeorm.io/ for reference on TypeORM best practices.
  • Refer to the design overview in the context files for better understanding.
src/domain/space/account/account.service.ts (1)

Pattern src/**/*.{ts,js}: Review the TypeScript/JavaScript code for NestJS best practices, dependency injection, module structure, and potential bugs.

Context Files (Do Not Review):

  • docs/Design.md - Design overview of the project
  • docs/Pagination.md - Pagination design overview
  • docs/Developing.md - Development setup overview
  • docs/graphql-typeorm-usage.md - overview of GraphQL and TypeORM usage and how they are used together with NestJS in the project
  • docs/database-definitions.md - guidelines for creating TypeORM entity defnitions
  • src/core/error-handling/graphql.exception.filter.ts - GraphQL error handling
  • src/core/error-handling/http.exception.filter.ts - HTTP error handling
  • src/core/error-handling/rest.error.response.ts - REST error response
  • src/core/error-handling/unhandled.exception.filter.ts - Global exception handler

Guidelines:

  • Our project uses global exception handlers (UnhandledExceptionFilter), so avoid suggesting additional try/catch blocks unless handling specific cases.
  • Use NestJS latest documentation from https://docs.nestjs.com/ for reference on NestJS best practices.
  • Use TypeORM latest documentation from https://typeorm.io/ for reference on TypeORM best practices.
  • Refer to the design overview in the context files for better understanding.
src/services/external/wingback/exceptions/wingback.customer.not.created.ts (1)

Pattern src/**/*.{ts,js}: Review the TypeScript/JavaScript code for NestJS best practices, dependency injection, module structure, and potential bugs.

Context Files (Do Not Review):

  • docs/Design.md - Design overview of the project
  • docs/Pagination.md - Pagination design overview
  • docs/Developing.md - Development setup overview
  • docs/graphql-typeorm-usage.md - overview of GraphQL and TypeORM usage and how they are used together with NestJS in the project
  • docs/database-definitions.md - guidelines for creating TypeORM entity defnitions
  • src/core/error-handling/graphql.exception.filter.ts - GraphQL error handling
  • src/core/error-handling/http.exception.filter.ts - HTTP error handling
  • src/core/error-handling/rest.error.response.ts - REST error response
  • src/core/error-handling/unhandled.exception.filter.ts - Global exception handler

Guidelines:

  • Our project uses global exception handlers (UnhandledExceptionFilter), so avoid suggesting additional try/catch blocks unless handling specific cases.
  • Use NestJS latest documentation from https://docs.nestjs.com/ for reference on NestJS best practices.
  • Use TypeORM latest documentation from https://typeorm.io/ for reference on TypeORM best practices.
  • Refer to the design overview in the context files for better understanding.
src/platform/licensing/wingback-subscription/licensing.wingback.subscription.service.ts (1)

Pattern src/**/*.{ts,js}: Review the TypeScript/JavaScript code for NestJS best practices, dependency injection, module structure, and potential bugs.

Context Files (Do Not Review):

  • docs/Design.md - Design overview of the project
  • docs/Pagination.md - Pagination design overview
  • docs/Developing.md - Development setup overview
  • docs/graphql-typeorm-usage.md - overview of GraphQL and TypeORM usage and how they are used together with NestJS in the project
  • docs/database-definitions.md - guidelines for creating TypeORM entity defnitions
  • src/core/error-handling/graphql.exception.filter.ts - GraphQL error handling
  • src/core/error-handling/http.exception.filter.ts - HTTP error handling
  • src/core/error-handling/rest.error.response.ts - REST error response
  • src/core/error-handling/unhandled.exception.filter.ts - Global exception handler

Guidelines:

  • Our project uses global exception handlers (UnhandledExceptionFilter), so avoid suggesting additional try/catch blocks unless handling specific cases.
  • Use NestJS latest documentation from https://docs.nestjs.com/ for reference on NestJS best practices.
  • Use TypeORM latest documentation from https://typeorm.io/ for reference on TypeORM best practices.
  • Refer to the design overview in the context files for better understanding.
src/platform/admin/licensing/admin.licensing.resolver.mutations.ts (1)

Pattern src/**/*.{ts,js}: Review the TypeScript/JavaScript code for NestJS best practices, dependency injection, module structure, and potential bugs.

Context Files (Do Not Review):

  • docs/Design.md - Design overview of the project
  • docs/Pagination.md - Pagination design overview
  • docs/Developing.md - Development setup overview
  • docs/graphql-typeorm-usage.md - overview of GraphQL and TypeORM usage and how they are used together with NestJS in the project
  • docs/database-definitions.md - guidelines for creating TypeORM entity defnitions
  • src/core/error-handling/graphql.exception.filter.ts - GraphQL error handling
  • src/core/error-handling/http.exception.filter.ts - HTTP error handling
  • src/core/error-handling/rest.error.response.ts - REST error response
  • src/core/error-handling/unhandled.exception.filter.ts - Global exception handler

Guidelines:

  • Our project uses global exception handlers (UnhandledExceptionFilter), so avoid suggesting additional try/catch blocks unless handling specific cases.
  • Use NestJS latest documentation from https://docs.nestjs.com/ for reference on NestJS best practices.
  • Use TypeORM latest documentation from https://typeorm.io/ for reference on TypeORM best practices.
  • Refer to the design overview in the context files for better understanding.
src/services/external/wingback/wingback.manager.ts (1)

Pattern src/**/*.{ts,js}: Review the TypeScript/JavaScript code for NestJS best practices, dependency injection, module structure, and potential bugs.

Context Files (Do Not Review):

  • docs/Design.md - Design overview of the project
  • docs/Pagination.md - Pagination design overview
  • docs/Developing.md - Development setup overview
  • docs/graphql-typeorm-usage.md - overview of GraphQL and TypeORM usage and how they are used together with NestJS in the project
  • docs/database-definitions.md - guidelines for creating TypeORM entity defnitions
  • src/core/error-handling/graphql.exception.filter.ts - GraphQL error handling
  • src/core/error-handling/http.exception.filter.ts - HTTP error handling
  • src/core/error-handling/rest.error.response.ts - REST error response
  • src/core/error-handling/unhandled.exception.filter.ts - Global exception handler

Guidelines:

  • Our project uses global exception handlers (UnhandledExceptionFilter), so avoid suggesting additional try/catch blocks unless handling specific cases.
  • Use NestJS latest documentation from https://docs.nestjs.com/ for reference on NestJS best practices.
  • Use TypeORM latest documentation from https://typeorm.io/ for reference on TypeORM best practices.
  • Refer to the design overview in the context files for better understanding.
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Travis CI - Pull Request
🔇 Additional comments (27)
src/services/external/wingback/wingback.manager.ts (7)

5-5: No issues with importing isAxiosError.


9-9: Renaming to CreateWingbackCustomer is clear for domain specificity.


18-20: These new exceptions add clarity to your domain-specific errors.


23-25: Appropriate usage of specialized error handlers.


209-214: Avoid returning undefined for all error responses.
Capturing only 404 errors and rethrowing 5xx or other unexpected errors can prevent masking legitimate issues.


252-254: JSDoc reflects new exceptions accurately.
Thank you for keeping the documentation in sync with the updated functionality.


257-257: Smart 4xx handling and wrapped Axios error.
Skipping retries on 4xx and converting Axios errors into WingbackException is consistent with robust error handling best practices.

Also applies to: 286-293, 323-331

src/common/exceptions/exception.details.ts (1)

10-10: Broadening originalException to unknown enhances flexibility.
This loosened type constraint accommodates various error object types.

src/services/external/wingback/exceptions/wingback.customer.not.found.ts (1)

1-4: Imports look good
The imports here are appropriate for a custom exception class, sourcing the base and related types from your common folder.

src/services/external/wingback/exceptions/wingback.customer.not.created.ts (2)

1-4: Dependencies are correct
The imports are clean and purposeful for extending the base exception.


5-13: Follows the established pattern
The class structure is consistent with your existing exception hierarchy, enhancing maintainability.

src/services/external/wingback/exceptions/wingback.customer.not.removed.ts (2)

1-4: Appropriate imports
Similar to the other exceptions, these imports align with your base exception model.


5-13: Confirm usage scenarios
Ensure that this exception is thrown exclusively in legitimate 'customer not removed' scenarios to maintain meaningful logs and error messages.

src/services/external/wingback/exceptions/wingback.exception.ts (2)

1-5: Imports are in order
No issues found: you have correctly imported types and classes relevant to the custom exception behavior.


22-24: Type guard implementation is straightforward
Using the instanceof check provides a simple, effective means of verifying a WingbackException.

src/services/external/wingback/types/wingback.type.create.customer.ts (5)

1-1: Name consistency improvement
Renaming the type to CreateWingbackCustomer improves clarity and avoids confusion with other creation processes.


3-3: Optional name property
Marking name as optional is a good idea, but ensure your logic gracefully handles the scenario when name is absent.


5-5: Flexible record type for emails
Using Record<string, string> for emails provides flexibility. Confirm that downstream validation and usage of email data can handle variable keys.


22-24: Optional tax details
Making tax_details (and vat_id) optional is sensible. Just verify flows that assume tax data exists to avoid potential null or undefined references.


28-29: Customer reference
Allowing an external system reference is beneficial. Double-check that references align with any required format or constraints.

src/platform/licensing/wingback-subscription/licensing.wingback.subscription.service.ts (2)

17-17: Importing new type
The import switch to CreateWingbackCustomer aligns with recent changes. All references appear updated correctly.


33-35: Updated method signature
Accepting CreateWingbackCustomer ensures consistency across the codebase. Looks good to proceed.

src/domain/space/account/account.service.license.ts (2)

5-5: Enhanced exception management
Importing EntityNotFoundException and related exceptions refines error handling for missing or uninitialized entities.


19-19: Using BaseExceptionInternal
Adopting BaseExceptionInternal maintains a cohesive exception strategy for internal checks.

src/platform/admin/licensing/admin.licensing.resolver.mutations.ts (2)

22-22: UUID import
Introducing the UUID scalar clarifies the expected argument type. This is consistent with other domain-level scalar usage.


37-56: New createWingbackAccount mutation
This mutation properly enforces authorization, retrieves the account, and delegates creation to the service layer. Implementation looks clear and maintainable.

src/domain/space/account/account.service.ts (1)

238-240: Verify whether returning undefined is the intended behavior.
Other methods in this service (e.g., getAccountOrFail) throw if an account is not found. This method, however, returns undefined. Double-check that this behavior is consistent with the API requirements.

src/domain/space/account/account.service.ts Outdated Show resolved Hide resolved
src/domain/space/account/account.service.ts Show resolved Hide resolved
@hero101 hero101 marked this pull request as draft January 24, 2025 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant