Skip to content

Jobber - Search & Filter Quotes #17263

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Jobber - Search & Filter Quotes #17263

wants to merge 5 commits into from

Conversation

michelle0927
Copy link
Collaborator

@michelle0927 michelle0927 commented Jun 24, 2025

Resolves #17158

Summary by CodeRabbit

  • New Features

    • Added the ability to filter quotes in Jobber based on various criteria, including status, client ID, quote number, and cost.
    • Introduced a search functionality to find quotes in Jobber using a search term, with support for pagination.
  • Chores

    • Updated version numbers for several Jobber actions and the Jobber integration package to reflect recent changes.

Copy link

vercel bot commented Jun 24, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs-v2 ⬜️ Ignored (Inspect) Visit Preview Jun 25, 2025 3:36pm
pipedream-docs ⬜️ Ignored (Inspect) Jun 25, 2025 3:36pm
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) Jun 25, 2025 3:36pm

Copy link
Contributor

coderabbitai bot commented Jun 24, 2025

Walkthrough

This update introduces two new Jobber action components: "Filter Quotes" and "Search Quotes," enabling users to retrieve and filter quotes using the Jobber GraphQL API. Supporting utilities, including paginated resource fetching and GraphQL field constants, were added. Several existing actions and the package version were incremented, with no functional changes to those actions.

Changes

File(s) Change Summary
components/jobber/actions/create-client/create-client.mjs Version bumped from 0.0.2 to 0.0.3
components/jobber/actions/create-quote/create-quote.mjs Version bumped from 0.0.2 to 0.0.3
components/jobber/actions/create-request/create-request.mjs Version bumped from 0.0.2 to 0.0.3
components/jobber/actions/filter-quotes/filter-quotes.mjs New action: filter quotes using various criteria and pagination via Jobber GraphQL API
components/jobber/actions/search-quotes/search-quotes.mjs New action: search quotes using a search term and pagination via Jobber GraphQL API
components/jobber/common/constants.mjs New file: exports GraphQL query fragment constant for quote fields
components/jobber/jobber.app.mjs Added paginate (async generator) and getPaginatedResources helper for paginated API data retrieval
components/jobber/package.json Package version updated from 0.1.1 to 0.2.1

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Action (Filter/Search Quotes)
    participant Jobber App
    participant Jobber API

    User->>Action (Filter/Search Quotes): Provide filter/search criteria
    Action (Filter/Search Quotes)->>Jobber App: Request paginated quotes (with criteria)
    loop For each page
        Jobber App->>Jobber API: Fetch quotes (GraphQL)
        Jobber API-->>Jobber App: Return quotes page
        Jobber App-->>Action (Filter/Search Quotes): Yield quotes
    end
    Action (Filter/Search Quotes)-->>User: Return filtered/searched quotes
Loading

Assessment against linked issues

Objective Addressed Explanation
Implement action to find/search/filter quotes and return full information (#17158)

Poem

A bunny hopped through Jobber’s code,
To help you find quotes on your road.
With filters and search,
You’ll never besmirch
The info you need in your load!

(🐇✨)

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

components/jobber/jobber.app.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
at Object.getPackageJSONURL (node:internal/modules/package_json_reader:255:9)
at packageResolve (node:internal/modules/esm/resolve:767:81)
at moduleResolve (node:internal/modules/esm/resolve:853:18)
at defaultResolve (node:internal/modules/esm/resolve:983:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:801:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:725:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:708:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:309:38)
at #link (node:internal/modules/esm/module_job:201:49)

components/jobber/actions/filter-quotes/filter-quotes.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
at Object.getPackageJSONURL (node:internal/modules/package_json_reader:255:9)
at packageResolve (node:internal/modules/esm/resolve:767:81)
at moduleResolve (node:internal/modules/esm/resolve:853:18)
at defaultResolve (node:internal/modules/esm/resolve:983:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:801:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:725:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:708:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:309:38)
at #link (node:internal/modules/esm/module_job:201:49)


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c46f435 and d41984b.

📒 Files selected for processing (2)
  • components/jobber/actions/filter-quotes/filter-quotes.mjs (1 hunks)
  • components/jobber/jobber.app.mjs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • components/jobber/actions/filter-quotes/filter-quotes.mjs
  • components/jobber/jobber.app.mjs
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Publish TypeScript components
  • GitHub Check: pnpm publish
  • GitHub Check: Lint Code Base
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this 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 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.

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

🧹 Nitpick comments (6)
components/jobber/actions/search-quotes/search-quotes.mjs (2)

7-7: Fix typo in description.

There's a typo in the description: "termin" should be "term".

-  description: "Search for quotes using a search termin Jobber. [See the documentation](https://developer.getjobber.com/docs)",
+  description: "Search for quotes using a search term in Jobber. [See the documentation](https://developer.getjobber.com/docs)",

26-52: Consider adding error handling for GraphQL queries.

The current implementation doesn't include explicit error handling for potential GraphQL query failures or network issues. Consider wrapping the getPaginatedResources call in a try-catch block to provide more informative error messages.

  async run({ $ }) {
+   try {
      const query = `query SearchQuotes($first: Int, $after: String, $searchTerm: String) {
        quotes(first: $first, after: $after, searchTerm: $searchTerm) {
          nodes {
            ${constants.QUOTE_FIELDS}
          }
          pageInfo {
            endCursor
            hasNextPage
          }
        }
      }`;

      const args = {
        searchTerm: this.searchTerm,
      };
      const quotes = await this.jobber.getPaginatedResources({
        query,
        args,
        resourceKey: "quotes",
        max: this.maxResults,
      });
      $.export("$summary", `Successfully found ${quotes.length} quote${quotes.length === 1
        ? ""
        : "s"}`);
      return quotes;
+   } catch (error) {
+     throw new Error(`Failed to search quotes: ${error.message}`);
+   }
  },
components/jobber/actions/filter-quotes/filter-quotes.mjs (3)

83-83: Remove debug console.log statement.

The console.log statement appears to be leftover debug code and should be removed before production.

-    console.log(args);

72-80: Consider safer type conversion and validation.

The current implementation uses the unary + operator for type conversion, which can produce NaN for invalid inputs. Consider adding validation or using safer conversion methods.

        quoteNumber: this.quoteNumber
          ? {
-            eq: +this.quoteNumber,
+            eq: parseInt(this.quoteNumber, 10),
          }
          : undefined,
        cost: this.cost
          ? {
-            eq: +this.cost,
+            eq: parseFloat(this.cost),
          }
          : undefined,

Alternatively, add validation:

+    // Validate numeric inputs
+    if (this.quoteNumber && isNaN(+this.quoteNumber)) {
+      throw new Error("Quote number must be a valid number");
+    }
+    if (this.cost && isNaN(+this.cost)) {
+      throw new Error("Cost must be a valid number");
+    }
+
     const args = {
       filter: {
         status: this.status,
         clientId: this.clientId,
         quoteNumber: this.quoteNumber
           ? {
             eq: +this.quoteNumber,
           }
           : undefined,
         cost: this.cost
           ? {
             eq: +this.cost,
           }
           : undefined,
       },
     };

54-94: Add error handling consistent with search action.

Similar to the search action, this component would benefit from explicit error handling around the GraphQL query execution.

  async run({ $ }) {
+   try {
      const query = `query FilterQuotes($first: Int, $after: String, $filter: QuoteFilterAttributes) {
        quotes(first: $first, after: $after, filter: $filter) {
          nodes {
            ${constants.QUOTE_FIELDS}
          }
          pageInfo {
            endCursor
            hasNextPage
          }
        }
      }`;

      const args = {
        filter: {
          status: this.status,
          clientId: this.clientId,
          quoteNumber: this.quoteNumber
            ? {
              eq: +this.quoteNumber,
            }
            : undefined,
          cost: this.cost
            ? {
              eq: +this.cost,
            }
            : undefined,
        },
      };
      const quotes = await this.jobber.getPaginatedResources({
        query,
        args,
        resourceKey: "quotes",
        max: this.maxResults,
      });
      $.export("$summary", `Successfully found ${quotes.length} quote${quotes.length === 1
        ? ""
        : "s"}`);
      return quotes;
+   } catch (error) {
+     throw new Error(`Failed to filter quotes: ${error.message}`);
+   }
  },
components/jobber/jobber.app.mjs (1)

127-134: Consider adding error handling to getPaginatedResources.

While the method itself is simple, adding error handling could provide better debugging information when pagination fails.

  async getPaginatedResources(args) {
+   try {
      const results = [];
      const resources = this.paginate(args);
      for await (const resource of resources) {
        results.push(resource);
      }
      return results;
+   } catch (error) {
+     throw new Error(`Failed to paginate resources: ${error.message}`);
+   }
  },
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5105a6c and c46f435.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (8)
  • components/jobber/actions/create-client/create-client.mjs (1 hunks)
  • components/jobber/actions/create-quote/create-quote.mjs (1 hunks)
  • components/jobber/actions/create-request/create-request.mjs (1 hunks)
  • components/jobber/actions/filter-quotes/filter-quotes.mjs (1 hunks)
  • components/jobber/actions/search-quotes/search-quotes.mjs (1 hunks)
  • components/jobber/common/constants.mjs (1 hunks)
  • components/jobber/jobber.app.mjs (1 hunks)
  • components/jobber/package.json (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Lint Code Base
  • GitHub Check: Publish TypeScript components
  • GitHub Check: pnpm publish
  • GitHub Check: Verify TypeScript components
🔇 Additional comments (7)
components/jobber/actions/create-request/create-request.mjs (1)

9-9: LGTM! Routine version bump.

The version increment is consistent with other action components in this PR and contains no functional changes.

components/jobber/actions/create-client/create-client.mjs (1)

8-8: LGTM! Consistent version increment.

The version bump aligns with other action components and introduces no functional changes.

components/jobber/actions/create-quote/create-quote.mjs (1)

7-7: LGTM! Version bump follows established pattern.

The version increment is consistent with other action components in this PR.

components/jobber/common/constants.mjs (1)

1-55: LGTM! Well-structured GraphQL field definitions.

The QUOTE_FIELDS constant provides a comprehensive and well-organized GraphQL fragment for retrieving quote data. The field selection covers all essential quote information including nested relationships (client, jobs, lineItems, etc.) and follows proper GraphQL syntax.

This centralization will support consistency across the new quote-related actions.

components/jobber/package.json (1)

3-3: LGTM! Appropriate minor version increment.

The version bump from "0.1.1" to "0.2.1" correctly reflects the addition of new quote filtering and searching functionality, following semantic versioning principles for new features.

components/jobber/actions/search-quotes/search-quotes.mjs (1)

1-2: Verify constants.QUOTE_FIELDS is properly defined.

The code imports and uses constants.QUOTE_FIELDS but we should ensure this constant exists and contains the correct GraphQL fields for quotes.

#!/bin/bash
# Description: Verify that QUOTE_FIELDS constant exists in the constants file
# Expected: Find the QUOTE_FIELDS constant definition

rg -A 10 "QUOTE_FIELDS" components/jobber/common/constants.mjs
components/jobber/actions/filter-quotes/filter-quotes.mjs (1)

16-23: Verify quote status options are complete and accurate.

The hardcoded status options should be verified against the Jobber API documentation to ensure they're complete and accurate.

What are the valid quote status values in the Jobber GraphQL API?

jcortes
jcortes previously approved these changes Jun 24, 2025
Copy link
Collaborator

@jcortes jcortes left a comment

Choose a reason for hiding this comment

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

Hi @michelle0927 lgtm! Ready for QA!

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.

[APP] jobber_find_a_quote
2 participants