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

Feat: Linear Integration (Ticketing) #612

Merged
merged 17 commits into from
Sep 3, 2024

Conversation

ganimtron-10
Copy link
Contributor

@ganimtron-10 ganimtron-10 commented Aug 5, 2024

Adding Linear Integration (Ticketing Vertical) #531

Objects

  • Ticket -> Issue
  • Comment -> Comment
  • Collection -> Project
  • Tag -> Labels
  • Team -> Team
  • User -> User

Summary by CodeRabbit

  • New Features

    • Added support for Linear ticketing integration, including new environment variables for configuration.
    • Introduced new services and mappers for managing tickets, comments, tags, and teams through the Linear API.
    • Enhanced the ticketing system with new types and interfaces specific to Linear collections and comments.
  • Bug Fixes

    • Resolved minor formatting issues and improved code consistency across modules.
  • Documentation

    • Updated documentation to reflect new features and integrations related to the Linear ticketing system.

@rflihxyz
Copy link
Contributor

rflihxyz commented Aug 5, 2024

Qovery Preview

Qovery can create a Preview Environment for this PR.
To trigger its creation, please post a comment with one of the following command.

Command Blueprint environment
/qovery preview 783d0240-ec38-4387-a9a9-8e225f1bd3e1 dev
/qovery preview {all|UUID1,UUID2,...} To preview multiple environments

This comment has been generated from Qovery AI 🤖.
Below, a word from its wisdom :

Programs must be written for people to read, and only incidentally for machines to execute

Copy link

changeset-bot bot commented Aug 5, 2024

⚠️ No Changeset found

Latest commit: fe2a4f2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

coderabbitai bot commented Aug 5, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

Walkthrough

The changes introduce integration with the Linear ticketing system, enhancing ticket management functionalities. This includes the addition of new environment variables, modifications to database schemas, and the creation of service classes and mappers specifically for the Linear API. These updates enable comprehensive handling of tickets, comments, users, tags, and teams, expanding integration options.

Changes

File(s) Change Summary
.env.example Added LINEAR_TICKETING_CLOUD_CLIENT_ID and LINEAR_TICKETING_CLOUD_CLIENT_SECRET for Linear API integration.
packages/api/scripts/init.sql Added tcg_linear boolean column to the connector_sets table for new connector type.
packages/api/scripts/seed.sql Updated INSERT INTO connector_sets to include the new tcg_linear column.
packages/shared/src/connectors/enum.ts Added LINEAR to the TicketingConnectors enum.
packages/shared/src/connectors/index.ts Updated TICKETING_PROVIDERS to include linear.
packages/api/src/ticketing/ticket/services/linear/mappers.ts Created LinearTicketMapper for mapping ticket data formats.
packages/api/src/ticketing/comment/services/linear/mappers.ts Created LinearCommentMapper for mapping comment formats.
packages/api/src/ticketing/tag/services/linear/mappers.ts Created LinearTagMapper for mapping tag data between formats.
packages/api/src/ticketing/team/services/linear/mappers.ts Created LinearTeamMapper for mapping team data structures.
packages/api/src/ticketing/user/services/linear/mappers.ts Created LinearUserMapper for transforming user data formats.
packages/api/src/ticketing/collection/services/linear/mappers.ts Created LinearCollectionMapper for transforming data between Linear and unified formats.
packages/api/src/ticketing/collection/services/linear/index.ts Introduced LinearService for syncing ticketing collections with Linear.
packages/api/src/ticketing/comment/services/linear/index.ts Introduced LinearService for managing comments with Linear API.
packages/api/src/ticketing/tag/services/linear/index.ts Introduced LinearService for synchronizing tag data with Linear.
packages/api/src/ticketing/team/services/linear/index.ts Introduced LinearService for syncing team data from Linear.
packages/api/src/ticketing/user/services/linear/index.ts Introduced LinearService for synchronizing user data with Linear.
packages/api/src/ticketing/ticket/services/linear/index.ts Introduced LinearService for ticket management with Linear.
packages/api/src/ticketing/user/user.module.ts Added LinearService and LinearUserMapper to exports in UserModule.

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 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 or @coderabbitai title 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.
Early access features: disabled

We are currently testing the following features in early access:

  • Anthropic claude-3-5-sonnet for code reviews: Anthropic claims that the new Claude model has stronger code understanding and code generation capabilities than their previous models. Note: Our default code review model was also updated late last week. Please compare the quality of the reviews between the two models by toggling the early access feature.

Note:

  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.
  • Please join our Discord Community to provide feedback and report issues on the discussion post.

@CLAassistant
Copy link

CLAassistant commented Aug 5, 2024

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ ganimtron-10
❌ naelob
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link

gitguardian bot commented Aug 9, 2024

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

Since your pull request originates from a forked repository, GitGuardian is not able to associate the secrets uncovered with secret incidents on your GitGuardian dashboard.
Skipping this check run and merging your pull request will create secret incidents on your GitGuardian dashboard.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
13351813 Triggered Generic Password 86dfb8c packages/shared/src/connectors/metadata.ts View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@ganimtron-10 ganimtron-10 marked this pull request as ready for review August 14, 2024 07:43
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: 33

Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

Commits

Files that changed from the base of the PR and between 6dcb65f and d6767c1.

Files selected for processing (31)
  • .env.example (1 hunks)
  • packages/api/scripts/init.sql (1 hunks)
  • packages/api/scripts/seed.sql (1 hunks)
  • packages/api/src/@core/utils/types/original/original.ticketing.ts (8 hunks)
  • packages/api/src/ticketing/@lib/@utils/index.ts (2 hunks)
  • packages/api/src/ticketing/collection/collection.module.ts (2 hunks)
  • packages/api/src/ticketing/collection/services/linear/index.ts (1 hunks)
  • packages/api/src/ticketing/collection/services/linear/mappers.ts (1 hunks)
  • packages/api/src/ticketing/collection/services/linear/types.ts (1 hunks)
  • packages/api/src/ticketing/comment/comment.module.ts (2 hunks)
  • packages/api/src/ticketing/comment/services/linear/index.ts (1 hunks)
  • packages/api/src/ticketing/comment/services/linear/mappers.ts (1 hunks)
  • packages/api/src/ticketing/comment/services/linear/types.ts (1 hunks)
  • packages/api/src/ticketing/tag/services/linear/index.ts (1 hunks)
  • packages/api/src/ticketing/tag/services/linear/mappers.ts (1 hunks)
  • packages/api/src/ticketing/tag/services/linear/types.ts (1 hunks)
  • packages/api/src/ticketing/tag/tag.module.ts (2 hunks)
  • packages/api/src/ticketing/team/services/linear/index.ts (1 hunks)
  • packages/api/src/ticketing/team/services/linear/mappers.ts (1 hunks)
  • packages/api/src/ticketing/team/services/linear/types.ts (1 hunks)
  • packages/api/src/ticketing/team/team.module.ts (2 hunks)
  • packages/api/src/ticketing/ticket/services/linear/index.ts (1 hunks)
  • packages/api/src/ticketing/ticket/services/linear/mappers.ts (1 hunks)
  • packages/api/src/ticketing/ticket/services/linear/types.ts (1 hunks)
  • packages/api/src/ticketing/ticket/ticket.module.ts (2 hunks)
  • packages/api/src/ticketing/user/services/linear/index.ts (1 hunks)
  • packages/api/src/ticketing/user/services/linear/mappers.ts (1 hunks)
  • packages/api/src/ticketing/user/services/linear/types.ts (1 hunks)
  • packages/api/src/ticketing/user/user.module.ts (2 hunks)
  • packages/shared/src/connectors/enum.ts (1 hunks)
  • packages/shared/src/connectors/index.ts (1 hunks)
Additional context used
Biome
packages/api/src/ticketing/user/services/linear/index.ts

[error] 23-23: Template literals are preferred over string concatenation.

Unsafe fix: Use a template literal.

(lint/style/useTemplate)


[error] 62-62: The catch clause that only rethrows the original error is redundant.

These unnecessary catch clauses can be confusing. It is recommended to remove them.

(lint/complexity/noUselessCatch)


[error] 44-44: This let declares a variable that is only assigned once.

'resp' is never reassigned.

Safe fix: Use const instead.

(lint/style/useConst)

packages/api/src/ticketing/tag/services/linear/index.ts

[error] 23-23: Template literals are preferred over string concatenation.

Unsafe fix: Use a template literal.

(lint/style/useTemplate)


[error] 62-62: The catch clause that only rethrows the original error is redundant.

These unnecessary catch clauses can be confusing. It is recommended to remove them.

(lint/complexity/noUselessCatch)


[error] 44-44: This let declares a variable that is only assigned once.

'resp' is never reassigned.

Safe fix: Use const instead.

(lint/style/useConst)

packages/api/src/ticketing/team/services/linear/index.ts

[error] 23-23: Template literals are preferred over string concatenation.

Unsafe fix: Use a template literal.

(lint/style/useTemplate)


[error] 62-62: The catch clause that only rethrows the original error is redundant.

These unnecessary catch clauses can be confusing. It is recommended to remove them.

(lint/complexity/noUselessCatch)


[error] 44-44: This let declares a variable that is only assigned once.

'resp' is never reassigned.

Safe fix: Use const instead.

(lint/style/useConst)

packages/api/src/ticketing/collection/services/linear/index.ts

[error] 23-23: Template literals are preferred over string concatenation.

Unsafe fix: Use a template literal.

(lint/style/useTemplate)


[error] 62-62: The catch clause that only rethrows the original error is redundant.

These unnecessary catch clauses can be confusing. It is recommended to remove them.

(lint/complexity/noUselessCatch)


[error] 44-44: This let declares a variable that is only assigned once.

'resp' is never reassigned.

Safe fix: Use const instead.

(lint/style/useConst)

packages/api/src/ticketing/comment/services/linear/index.ts

[error] 11-11: A Node.js builtin module should be imported with the node: protocol.

Using the node: protocol is more explicit and signals that the imported module belongs to Node.js.
Unsafe fix: Add the node: protocol.

(lint/style/useNodejsImportProtocol)


[error] 26-26: Template literals are preferred over string concatenation.

Unsafe fix: Use a template literal.

(lint/style/useTemplate)


[error] 69-69: The catch clause that only rethrows the original error is redundant.

These unnecessary catch clauses can be confusing. It is recommended to remove them.

(lint/complexity/noUselessCatch)


[error] 115-115: The catch clause that only rethrows the original error is redundant.

These unnecessary catch clauses can be confusing. It is recommended to remove them.

(lint/complexity/noUselessCatch)


[error] 51-51: This let declares a variable that is only assigned once.

'resp' is never reassigned.

Safe fix: Use const instead.

(lint/style/useConst)


[error] 97-97: This let declares a variable that is only assigned once.

'resp' is never reassigned.

Safe fix: Use const instead.

(lint/style/useConst)

packages/api/src/ticketing/ticket/services/linear/index.ts

[error] 24-24: Template literals are preferred over string concatenation.

Unsafe fix: Use a template literal.

(lint/style/useTemplate)


[error] 82-82: The catch clause that only rethrows the original error is redundant.

These unnecessary catch clauses can be confusing. It is recommended to remove them.

(lint/complexity/noUselessCatch)


[error] 119-119: The catch clause that only rethrows the original error is redundant.

These unnecessary catch clauses can be confusing. It is recommended to remove them.

(lint/complexity/noUselessCatch)


[error] 64-64: This let declares a variable that is only assigned once.

'resp' is never reassigned.

Safe fix: Use const instead.

(lint/style/useConst)


[error] 101-101: This let declares a variable that is only assigned once.

'resp' is never reassigned.

Safe fix: Use const instead.

(lint/style/useConst)

packages/api/src/ticketing/@lib/@utils/index.ts

[error] 40-40: The catch clause that only rethrows the original error is redundant.

These unnecessary catch clauses can be confusing. It is recommended to remove them.

(lint/complexity/noUselessCatch)

Additional comments not posted (50)
packages/api/src/ticketing/tag/services/linear/types.ts (1)

1-7: LGTM!

The type definitions for LinearTag, LinearTagInput, and LinearTagOutput are straightforward and correctly use TypeScript's Partial utility type. This approach provides flexibility in handling tag data related to Linear.

packages/api/src/ticketing/user/services/linear/types.ts (1)

1-8: LGTM!

The type definitions for LinearUser, LinearUserInput, and LinearUserOutput are well-structured and consistent with the approach used in the LinearTag types. This consistency is beneficial for maintainability.

packages/api/src/ticketing/team/services/linear/types.ts (1)

1-8: LGTM!

The type definitions for LinearTeam, LinearTeamInput, and LinearTeamOutput are consistent with the other Linear-related types. The use of Partial is appropriate and maintains consistency across the codebase.

packages/api/src/ticketing/collection/services/linear/types.ts (2)

1-5: LGTM!

The LinearCollection interface is well-defined with appropriate properties.


7-7: LGTM!

Using Partial<LinearCollection> for LinearCollectionInput is a good approach to handle optional fields.

packages/api/src/ticketing/comment/services/linear/types.ts (2)

1-10: LGTM!

The LinearComment interface is well-defined with appropriate properties and nested structures.


12-12: LGTM!

Using Partial<LinearComment> for LinearCommentInput is a good approach to handle optional fields.

packages/shared/src/connectors/index.ts (1)

5-5: LGTM!

The addition of gorgias and linear to TICKETING_PROVIDERS appropriately expands the list of supported providers.

packages/shared/src/connectors/enum.ts (1)

22-23: Verify usage of the new LINEAR enum value.

The addition of LINEAR to the TicketingConnectors enum looks correct. Ensure that this new value is properly handled throughout the codebase, including any switch cases or logic that processes TicketingConnectors.

packages/api/src/ticketing/ticket/services/linear/types.ts (1)

4-30: Verify alignment with Linear API documentation.

The LinearTicket type is defined to represent a ticket in Linear. Ensure that the structure aligns with the Linear API's expected format and fields.

packages/api/scripts/seed.sql (1)

4-7: Verify usage of the new tcg_linear column.

The addition of the tcg_linear column in the connector_sets table is consistent with the Linear integration. Ensure that this new column is correctly utilized in the application logic and any related queries.

packages/api/src/ticketing/team/team.module.ts (1)

1-2: Integration of Linear services looks good.

The addition of LinearService and LinearTeamMapper to the TeamModule appears correct and consistent with the module's structure.

Ensure that the implementations of LinearService and LinearTeamMapper are complete and correctly integrated.

Also applies to: 44-45

Verification successful

Verification Successful: LinearService and LinearTeamMapper Implementations Found

The LinearService and LinearTeamMapper classes are implemented and integrated correctly within the codebase. The LinearService has context-specific implementations, and LinearTeamMapper is implemented as expected.

  • LinearService implementations found in:
    • packages/api/src/ticketing/team/services/linear/index.ts
    • Other contexts like user, ticket, tag, comment, collection services.
  • LinearTeamMapper implementation found in:
    • packages/api/src/ticketing/team/services/linear/mappers.ts

The integration in the TeamModule is consistent with these implementations.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation of LinearService and LinearTeamMapper.

# Test: Search for the class definitions. Expect: Correct and complete implementations.
ast-grep --lang typescript --pattern $'class LinearService { $$$ }'
ast-grep --lang typescript --pattern $'class LinearTeamMapper { $$$ }'

Length of output: 140


Script:

#!/bin/bash
# Re-running the search with additional context lines for better clarity.

# Search for the LinearService class definition with context.
rg 'class LinearService' -A 10 --type=typescript

# Search for the LinearTeamMapper class definition with context.
rg 'class LinearTeamMapper' -A 10 --type=typescript

Length of output: 174


Script:

#!/bin/bash
# Re-running the search without specifying the file type to avoid errors.

# Search for the LinearService class definition.
rg 'class LinearService' -A 10

# Search for the LinearTeamMapper class definition.
rg 'class LinearTeamMapper' -A 10

Length of output: 7315

packages/api/src/ticketing/tag/services/linear/mappers.ts (1)

26-40: Verify the mapping logic in unify method.

The unify method converts the source to an array and maps it to unified tags. Ensure that mapSingleTagToUnified correctly handles all necessary fields and edge cases.

packages/api/src/ticketing/team/services/linear/mappers.ts (1)

26-40: Verify the mapping logic in unify method.

The unify method converts the source to an array and maps it to unified teams. Ensure that mapSingleTeamToUnified correctly handles all necessary fields and edge cases.

packages/api/src/ticketing/tag/tag.module.ts (1)

1-2: Integration of Linear services.

The addition of LinearTagMapper and LinearService imports suggests an enhancement to support Linear tagging. Ensure that these services are correctly implemented and integrated within the module.

packages/api/src/ticketing/user/user.module.ts (2)

1-2: Integration of Linear user services.

The addition of LinearUserMapper and LinearService imports enhances the module to support Linear user mapping. Ensure that these services are correctly implemented and integrated within the module.


47-48: Update in module exports.

The LinearService and LinearUserMapper are now exported, which allows them to be used outside this module. Verify that this change aligns with the intended architecture and that these exports are necessary.

Verification successful

Export of LinearService is necessary; review LinearUserMapper export.

The LinearService is utilized across multiple modules, confirming the necessity of its export. However, there are no external references to LinearUserMapper, suggesting its export might be unnecessary unless future use is planned.

  • LinearService is used in:

    • ticket.module.ts
    • tag.module.ts
    • team.module.ts
    • comment.module.ts
    • collection.module.ts
  • LinearUserMapper has no external references.

Consider reviewing the export of LinearUserMapper to ensure it aligns with your architectural plans.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of LinearService and LinearUserMapper in other modules.

# Test: Search for the usage of LinearService and LinearUserMapper. Expect: Valid references in other modules.
rg --type ts 'LinearService|LinearUserMapper'

Length of output: 2825

packages/api/src/ticketing/collection/collection.module.ts (1)

1-2: Integration of Linear collection services.

The addition of LinearCollectionMapper and LinearService imports suggests an enhancement to support Linear collections. Ensure that these services are correctly implemented and integrated within the module.

packages/api/src/ticketing/ticket/ticket.module.ts (2)

47-48: Verify Export of Linear Services and Mappers.

LinearService and LinearTicketMapper are added to the providers array. Ensure these are necessary and used elsewhere in the application.

Verification successful

LinearService and LinearTicketMapper are Necessary and Used in the Application

  • LinearService is extensively used across multiple modules such as comment, team, user, collection, tag, and ticket.
  • LinearTicketMapper is used in the ticket module and has a dedicated implementation.

Both are essential components of the application.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify usage of LinearService and LinearTicketMapper in the codebase.

# Test: Search for references to LinearService and LinearTicketMapper.
rg --type typescript 'LinearService'
rg --type typescript 'LinearTicketMapper'

Length of output: 148


Script:

#!/bin/bash
# Description: Verify usage of LinearService and LinearTicketMapper in the codebase.

# Test: Search for references to LinearService and LinearTicketMapper in TypeScript files.
rg --type ts 'LinearService'
rg --type ts 'LinearTicketMapper'

Length of output: 2858


1-2: Ensure Correct Integration of Linear Imports.

The imports for LinearTicketMapper and LinearService have been added. Verify that these services are correctly implemented and their dependencies are resolved.

Verification successful

Linear Imports are Correctly Integrated

The LinearService and LinearTicketMapper are implemented and available in the codebase. The imports in ticket.module.ts are correctly integrated. No further action is necessary.

  • LinearService is defined in several service modules, each implementing different interfaces.
  • LinearTicketMapper is implemented in mappers.ts.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation of LinearService and LinearTicketMapper.

# Test: Check for the presence of LinearService and LinearTicketMapper implementations.
ast-grep --lang typescript --pattern $'class LinearService { $$$ }'
ast-grep --lang typescript --pattern $'class LinearTicketMapper { $$$ }'

Length of output: 142


Script:

#!/bin/bash
# Description: Search for any definition or export of LinearService and LinearTicketMapper.

# Search for LinearService definition or export
rg 'LinearService' -A 3

# Search for LinearTicketMapper definition or export
rg 'LinearTicketMapper' -A 3

Length of output: 10333

packages/api/src/ticketing/comment/comment.module.ts (2)

50-51: Verify Export of Linear Comment Services and Mappers.

LinearService and LinearCommentMapper are added to the providers array. Ensure these are necessary and used elsewhere in the application.

Verification successful

LinearService and LinearCommentMapper Usage Verified

Both LinearService and LinearCommentMapper are used across the application, indicating their necessity:

  • LinearCommentMapper is defined and used in comment.module.ts.
  • LinearService is utilized in multiple modules, including user.module.ts, tag.module.ts, ticket.module.ts, collection.module.ts, team.module.ts, and comment.module.ts.

Their inclusion in the providers array is justified.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify usage of LinearCommentMapper and LinearService in the codebase.

# Test: Search for references to LinearCommentMapper and LinearService.
rg --type typescript 'LinearCommentMapper'
rg --type typescript 'LinearService'

Length of output: 149


Script:

#!/bin/bash
# Corrected script to verify usage of LinearCommentMapper and LinearService in the codebase.

# Test: Search for references to LinearCommentMapper and LinearService in TypeScript files.
rg --type ts 'LinearCommentMapper'
rg --type ts 'LinearService'

Length of output: 2868


1-2: Ensure Correct Integration of Linear Comment Imports.

The imports for LinearCommentMapper and LinearService have been added. Verify that these services are correctly implemented and their dependencies are resolved.

packages/api/src/ticketing/collection/services/linear/mappers.ts (3)

51-68: Ensure Completeness of mapSingleCollectionToUnified.

The mapSingleCollectionToUnified method maps a single collection to the unified format. Confirm that all required fields are mapped and consider adding error handling.


11-20: Review Registration of LinearCollectionMapper.

The LinearCollectionMapper is registered with the MappersRegistry. Ensure that this registration is necessary and correctly implemented.

Verification successful

LinearCollectionMapper Registration Verified

The LinearCollectionMapper is registered with the MappersRegistry using the registerService method. The method is defined in the MappersRegistry class, which uses a composite key to register services. The registration appears to be correctly implemented as per the codebase.

  • File: packages/api/src/ticketing/collection/services/linear/mappers.ts
  • Registration Method: registerService('ticketing', 'collection', 'linear', this)
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify registration of LinearCollectionMapper in MappersRegistry.

# Test: Check for the registration method and its usage in MappersRegistry.
rg --type typescript 'registerService.*LinearCollectionMapper'

Length of output: 99


Script:

#!/bin/bash
# Description: Verify registration of LinearCollectionMapper in MappersRegistry.

# Corrected Test: Check for the registration method and its usage in MappersRegistry.
rg --type ts 'registerService.*LinearCollectionMapper'

Length of output: 56


Script:

#!/bin/bash
# Description: Search for the definition and usage of the registerService method in the MappersRegistry class.

# Search for the registerService method definition in TypeScript files.
rg --type ts 'registerService' -A 5

# Search for the MappersRegistry class definition to understand its structure.
rg --type ts 'class MappersRegistry' -A 10

Length of output: 291347


31-49: Verify Logic in Unify Method.

The unify method maps collections to a unified format. Ensure that all necessary fields are mapped and consider handling potential errors or edge cases.

packages/api/src/ticketing/user/services/linear/mappers.ts (2)

13-15: Ensure correct service registration.

The constructor registers the service with the MappersRegistry. Ensure that this registration is correctly handled elsewhere in the application to avoid potential issues with service discovery.


40-67: Verify field mapping logic.

The mapSingleUserToUnified method maps custom fields. Ensure that the remote_id used in user[mapping.remote_id] exists and is correctly mapped to prevent undefined values.

packages/api/src/ticketing/team/services/linear/index.ts (1)

1-12: Consider reviewing import paths.

Ensure that the import paths are correct and consistent with the project's structure. The use of @@core and @ticketing suggests a specific alias setup, which should be verified for correctness.

packages/api/src/ticketing/collection/services/linear/index.ts (1)

1-12: Consider reviewing import paths.

Ensure that the import paths are correct and consistent with the project's structure.

packages/api/src/ticketing/comment/services/linear/mappers.ts (4)

1-13: Consider reviewing import paths.

Ensure that the import paths are correct and consistent with the project's structure.


22-27: Ensure registration logic is correct.

Verify that the service registration logic aligns with the application's architecture and that the service is correctly utilized within the system.


55-70: Optimize array mapping with Promise.all.

The use of Promise.all for mapping over source is appropriate, but ensure that all promises resolve correctly and handle any potential errors.


83-87: Ensure user ID retrieval logic is robust.

Ensure that the getUserUuidFromRemoteId method handles all edge cases, such as missing or invalid user IDs.

.env.example (1)

96-98: Environment variables for Linear integration added successfully.

The addition of LINEAR_TICKETING_CLOUD_CLIENT_ID and LINEAR_TICKETING_CLOUD_CLIENT_SECRET is consistent with the integration objectives.

packages/api/src/ticketing/ticket/services/linear/index.ts (1)

1-13: Imports are appropriate and necessary.

The imported modules are relevant for the functionality implemented in this file.

packages/api/src/ticketing/@lib/@utils/index.ts (1)

8-8: Formatting change is acceptable.

The addition of a space in the constructor does not affect functionality.

packages/api/src/ticketing/ticket/services/linear/mappers.ts (1)

19-28: Ensure proper registration in the constructor.

The constructor registers the service with the MappersRegistry. Verify that this registration does not conflict with existing services and that the registry is correctly handling the new mapper.

Verification successful

No immediate conflict detected, but potential for future conflicts exists.

The registerService method in MappersRegistry directly registers services without checking for existing entries, which could lead to conflicts if multiple services are registered with the same key. Currently, there are no other services registered with the key ("ticketing", "ticket", "linear"), so no conflict exists. However, consider adding conflict checks to prevent future issues.

  • Location of registerService implementation:
    • packages/api/src/@core/@core-services/registries/mappers.registry.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the registration of the LinearTicketMapper in the MappersRegistry.

# Test: Check for other registrations of 'ticketing', 'ticket', 'linear' to ensure no conflicts.
rg --type ts 'registerService\("ticketing", "ticket", "linear"'

Length of output: 65


Script:

#!/bin/bash
# Search for the implementation of the registerService method in the MappersRegistry class
ast-grep --lang typescript --pattern 'class MappersRegistry { $$$ registerService($_, $_, $_, $_) { $$$ } $$$ }'

Length of output: 5231

packages/api/src/@core/utils/types/original/original.ticketing.ts (12)

160-160: Integration of LinearTicketInput is consistent.

The addition of LinearTicketInput to OriginalTicketInput is consistent with existing patterns.


169-169: Integration of LinearCommentInput is consistent.

The addition of LinearCommentInput to OriginalCommentInput is consistent with existing patterns.


176-176: Integration of LinearUserInput is consistent.

The addition of LinearUserInput to OriginalUserInput is consistent with existing patterns.


192-192: Integration of LinearTagInput is consistent.

The addition of LinearTagInput to OriginalTagInput is consistent with existing patterns.


199-199: Integration of LinearTeamInput is consistent.

The addition of LinearTeamInput to OriginalTeamInput is consistent with existing patterns.


205-205: Integration of LinearCollectionInput is consistent.

The addition of LinearCollectionInput to OriginalCollectionInput is consistent with existing patterns.


226-226: Integration of LinearTicketOutput is consistent.

The addition of LinearTicketOutput to OriginalTicketOutput is consistent with existing patterns.


234-234: Integration of LinearCommentOutput is consistent.

The addition of LinearCommentOutput to OriginalCommentOutput is consistent with existing patterns.


240-240: Integration of LinearUserOutput is consistent.

The addition of LinearUserOutput to OriginalUserOutput is consistent with existing patterns.


255-255: Integration of LinearTagOutput is consistent.

The addition of LinearTagOutput to OriginalTagOutput is consistent with existing patterns.


262-262: Integration of LinearTeamOutput is consistent.

The addition of LinearTeamOutput to OriginalTeamOutput is consistent with existing patterns.


275-275: Integration of LinearCollectionOutput is consistent.

The addition of LinearCollectionOutput to OriginalCollectionOutput is consistent with existing patterns.

packages/api/scripts/init.sql (1)

548-548: Ensure the new column tcg_linear aligns with database requirements.

The addition of the tcg_linear column of type boolean to the connector_sets table appears to be straightforward. Ensure that any application logic or queries interacting with this table are updated to accommodate this new column. Additionally, consider whether a default value or constraint is necessary based on its intended use.

Verification successful

Verify integration of tcg_linear in application logic and queries.

The tcg_linear column has been integrated into the database schema and is referenced in the seed data and application logic. Ensure that:

  • The INSERT statements in seed.sql and any dynamic handling in connectorUpdate.js correctly include tcg_linear.
  • The Prisma operations in project-connectors.service.ts and projects.service.ts are updated, if necessary, to handle this new column appropriately.

No immediate issues were found, but a thorough review of the related logic is recommended to ensure consistency and correctness.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify if there are any queries or application logic that need to be updated to accommodate the new `tcg_linear` column.

# Test: Search for usage of `connector_sets` in SQL and application code. Expect: Identify any references that may need updates.
rg --type sql --type py --type js --type ts 'connector_sets'

Length of output: 1736

@ganimtron-10
Copy link
Contributor Author

Hi, @naelob @rflihxyz PTAL

@ganimtron-10 ganimtron-10 changed the title Feat: Linear (Ticketing) Integration Feat: Linear Integration (Ticketing) Aug 14, 2024
@naelob naelob merged commit 5aa5b58 into panoratech:main Sep 3, 2024
7 of 13 checks passed
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.

4 participants