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

Greenhouse ATS Application Creation #629

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

MayankTamakuwala
Copy link

@MayankTamakuwala MayankTamakuwala commented Aug 7, 2024

Feat#569: GreenHouse "Application Creation" Integration Update

Summary by CodeRabbit

  • New Features

    • Introduced GreenhouseService for managing job applications in the Greenhouse recruitment platform.
    • Implemented methods for adding applications and synchronizing existing ones.
    • Added GreenhouseApplicationMapper for transforming data between Greenhouse and ATS formats.
    • Defined TypeScript types for structured handling of application data.
  • Bug Fixes

    • Enhanced error handling in the service methods to improve robustness and user experience.

@rflihxyz
Copy link
Contributor

rflihxyz commented Aug 7, 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 :

Take rest sometimes

Copy link

changeset-bot bot commented Aug 7, 2024

⚠️ No Changeset found

Latest commit: 036d0ad

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.

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

@CLAassistant
Copy link

CLAassistant commented Aug 7, 2024

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

coderabbitai bot commented Aug 7, 2024

Walkthrough

Walkthrough

The recent updates introduce a new GreenhouseService for managing job applications through the Greenhouse recruitment platform. It includes methods for adding applications and synchronizing user application data. Additionally, a GreenhouseApplicationMapper facilitates data transformation between Greenhouse and ATS formats. New TypeScript types define the structures for application inputs and outputs, enhancing data handling and type safety across the API.

Changes

Files Change Summary
.../greenhouse/index.ts Introduced GreenhouseService class with addApplication and sync methods for application management.
.../greenhouse/mappers.ts Added GreenhouseApplicationMapper for transforming data between Greenhouse and ATS formats, with desunify and unify methods.
.../greenhouse/types.ts Defined GreenhouseApplicationInput and GreenhouseApplicationOutput types for structured data handling.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant GreenhouseService
    participant Database
    participant GreenhouseAPI

    User->>GreenhouseService: addApplication(applicationData, linkedUserId)
    GreenhouseService->>Database: fetchUserDetails(linkedUserId)
    Database-->>GreenhouseService: userDetails
    GreenhouseService->>GreenhouseAPI: POST application data
    GreenhouseAPI-->>GreenhouseService: response
    GreenhouseService-->>User: ApiResponse(success message)

    User->>GreenhouseService: sync(linkedUserId)
    GreenhouseService->>Database: fetchUserDetails(linkedUserId)
    Database-->>GreenhouseService: userDetails
    GreenhouseService->>GreenhouseAPI: POST request for applications
    GreenhouseAPI-->>GreenhouseService: applications data
    GreenhouseService-->>User: ApiResponse(applications list)
Loading

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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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.

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

Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

Commits

Files that changed from the base of the PR and between c8e8e06 and 036d0ad.

Files selected for processing (3)
  • packages/api/src/ats/application/services/greenhouse/index.ts (1 hunks)
  • packages/api/src/ats/application/services/greenhouse/mappers.ts (1 hunks)
  • packages/api/src/ats/application/services/greenhouse/types.ts (1 hunks)
Additional context used
Biome
packages/api/src/ats/application/services/greenhouse/index.ts

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

Unsafe fix: Use a template literal.

(lint/style/useTemplate)


[error] 64-64: 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] 101-101: 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 (6)
packages/api/src/ats/application/services/greenhouse/types.ts (3)

13-26: LGTM!

The Attachments type is well-defined and effectively uses a union type to enforce mutually exclusive fields.


28-57: LGTM!

The ContentTypes type is comprehensive and well-organized.


59-110: LGTM!

The GreenhouseApplicationOutput type is well-structured and comprehensive.

packages/api/src/ats/application/services/greenhouse/mappers.ts (3)

16-29: LGTM!

The constructor correctly registers the mapper with the registry.


69-94: LGTM!

The unify method correctly handles both single and multiple application outputs.


96-138: LGTM!

The mapSingleApplicationToUnified method performs necessary transformations and handles optional fields correctly.

Comment on lines +1 to +11
export type GreenhouseApplicationInput = Partial<{
job_id: number;
source_id: number;
[key: string]: any;
initial_stage_id: number;
referrer: {
type: 'id' | 'email' | 'outside';
value: string;
};
attachments: Array<Attachments>;
}>;
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider the implications of using an index signature.

The use of an index signature [key: string]: any; allows for flexibility but reduces type safety. Consider whether this is necessary or if specific fields can be defined to enhance type safety.

Comment on lines +100 to +102
} catch (error) {
throw error;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove redundant catch block.

The catch block only rethrows the original error, which is unnecessary. Consider removing it.

-    } catch (error) {
-      throw error;
-    }
+    }
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
} catch (error) {
throw error;
}
}
Tools
Biome

[error] 101-101: 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)

Comment on lines +63 to +65
} catch (error) {
throw error;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove redundant catch block.

The catch block only rethrows the original error, which is unnecessary. Consider removing it.

-    } catch (error) {
-      throw error;
-    }
+    }
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
} catch (error) {
throw error;
}
}
Tools
Biome

[error] 64-64: 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)

Comment on lines +27 to +29
this.logger.setContext(
AtsObject.application.toUpperCase() + ':' + GreenhouseService.name,
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Use template literals for string concatenation.

Consider using template literals for better readability and performance.

-    this.logger.setContext(
-      AtsObject.application.toUpperCase() + ':' + GreenhouseService.name,
-    );
+    this.logger.setContext(
+      `${AtsObject.application.toUpperCase()}:${GreenhouseService.name}`,
+    );
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
this.logger.setContext(
AtsObject.application.toUpperCase() + ':' + GreenhouseService.name,
);
this.logger.setContext(
`${AtsObject.application.toUpperCase()}:${GreenhouseService.name}`,
);
Tools
Biome

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

Unsafe fix: Use a template literal.

(lint/style/useTemplate)

Comment on lines +51 to +54
const res: any = {
canidateId: candidateId,
jobId: jobId,
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Fix typo in object key.

The object key canidateId is misspelled. It should be candidateId.

-    const res: any = {
-      canidateId: candidateId,
-      jobId: jobId,
-    };
+    const res: any = {
+      candidateId: candidateId,
+      jobId: jobId,
+    };
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const res: any = {
canidateId: candidateId,
jobId: jobId,
};
const res: any = {
candidateId: candidateId,
jobId: jobId,
};

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.

3 participants