Skip to content

Conversation

@michelle0927
Copy link
Collaborator

@michelle0927 michelle0927 commented Mar 14, 2025

Resolves #15747

Summary by CodeRabbit

  • New Features

    • Introduced streamlined ways to create business, commercial, and residential property listings with comprehensive details.
    • Added robust categorization of property types for enhanced listing classification.
    • Enabled real-time event notifications and improved data handling for agency listings, ensuring timely updates and smooth pagination.
  • Chores

    • Upgraded the package version and updated platform dependencies to boost overall stability and performance.

@vercel
Copy link

vercel bot commented Mar 14, 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) Mar 14, 2025 7:51pm
pipedream-docs ⬜️ Ignored (Inspect) Mar 14, 2025 7:51pm
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) Mar 14, 2025 7:51pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 14, 2025

Walkthrough

This PR introduces new modules for creating business, commercial, and residential listings within the domain group. It adds detailed action modules with asynchronous run methods that interface with the domain group's API, along with a shared module for property type constants. The domain group application's property definitions and API methods have been expanded to support listing creation, pagination, and agency operations. Several new source modules have been added to handle agency listing updates and new agency events. The package version has been bumped and a dependency was added.

Changes

File(s) Change Summary
components/domain_group/actions/.../create-*-listing.mjs New action modules for creating business, commercial, and residential listings. Each exports an action with metadata, property definitions, and an asynchronous run method that calls the corresponding creation function in the domain group API.
components/domain_group/common/property-types.mjs Introduces and exports constants (BUSINESS_TYPES, RESIDENTIAL_TYPES, COMMERCIAL_TYPES) to standardize property type options.
components/domain_group/domain_group.app.mjs Expands property definitions and adds new API methods (e.g., _baseUrl, _makeRequest, listAgencies, listAgencyListings, create*Listing, and paginate) to support listing operations.
components/domain_group/package.json Updates package version from 0.0.1 to 0.1.0 and adds a dependency on @pipedream/platform (^3.0.3).
components/domain_group/sources/.../*.mjs New source modules for handling agency listing updates, new agency creation, and new agency listings. Also adds a common base module with helper methods for data fetching and event emission.

Sequence Diagram(s)

sequenceDiagram
    participant U as User/Context
    participant AM as Action Module (Create Listing)
    participant DG as DomainGroup API
    U->>AM: Invoke run(context)
    AM->>DG: Prepare and send listing data
    DG-->>AM: Return created listing ID
    AM->>U: Return summary with listing ID
Loading
sequenceDiagram
    participant S as Scheduler
    participant SM as Source Module
    participant DG as DomainGroup API
    S->>SM: Trigger getResults
    SM->>DG: Fetch updated listings or new agencies
    DG-->>SM: Return listings data
    SM->>SM: Generate metadata for each item
    SM->>S: Emit event with metadata
Loading

Possibly related PRs

  • New Components - suitedash #14311: Introduces new modules for creating entities like companies and contacts with similar asynchronous API handling and module structures.

Suggested labels

action, trigger / source

Suggested reviewers

  • jcortes

Poem

I'm a rabbit in the code garden, hopping with delight,
New listings and updates spring into sight.
Business, commercial, and homes all take flight,
With API calls that sparkle, ever so bright.
I nibble on code carrots, enjoying the stroll—
Happy to see these changes make our app whole! 🐰✨

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.

Scope: all 2 workspace projects
 ERR_PNPM_OPTIONAL_DEPS_REQUIRE_PROD_DEPS  Optional dependencies cannot be installed without production dependencies

Tip

⚡🧪 Multi-step agentic review comment chat (experimental)
  • We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
    - To enable this feature, set early_access to true under in the settings.
✨ 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.
    • 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.
  • @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 (12)
components/domain_group/sources/new-agency-created/new-agency-created.mjs (1)

13-20: Simplify the getResults method.

The current implementation creates an array, loops through agencies, and pushes each one to the array. This can be simplified since the agencies variable is likely already an array.

async getResults() {
  const agencies = await this.domainGroup.listAgencies();
-  const results = [];
-  for (const agency of agencies) {
-    results.push(agency);
-  }
-  return results;
+  return agencies;
}
components/domain_group/sources/common/base.mjs (4)

17-23: Consider default fallback for no stored timestamp
If lastTs doesn't exist in the database (e.g., first run), _getLastTs() will return undefined. Ensure that your downstream logic gracefully handles this scenario (e.g., treat undefined as a zero or minimal timestamp for retrieval).


27-56: Validate item timestamps before parsing
The code calls Date.parse(ts), but doesn't verify that item[tsField] exists or is valid. If tsField is undefined or null, Date.parse() might yield NaN. Consider adding a check to ensure valid timestamps and gracefully handle any malformed data.


57-66: Clarify or implement configuration methods
The getResourceFn(), getTsField(), and generateMeta() methods are not implemented yet and raise ConfigurationError. Confirm that child classes override and implement these methods; otherwise, this source will fail at runtime.


67-78: Potentially expose run results
Inside run(), you emit items and then return if empty. If debugging or chaining is required later, consider returning the processed results or logging them. This can help when investigating issues or verifying outputs in subsequent steps.

components/domain_group/actions/create-commercial-listing/create-commercial-listing.mjs (2)

4-138: Validate required props and handle missing data
Your props are defined with multiple required fields (agencyId, providerAdId, streetNumber, etc.). If users fail to provide them, the call to createCommercialListing() might result in errors. Consider adding form-level or runtime validations to provide clearer error messages before making the API call.


139-182: Handle unexpected listingAction values
listingAction can be “sale”, “rent”, or “saleAndLease”; you account for these cases. Consider adding a default scenario or explicit validation if a user somehow provides a value outside these three enumerations.

components/domain_group/actions/create-residential-listing/create-residential-listing.mjs (1)

116-149: Consider adding error handling to the run method

The current implementation doesn't include explicit error handling. Adding try/catch blocks would improve user experience by providing more specific error messages when API calls fail.

  async run({ $ }) {
+   try {
      const response = await this.domainGroup.createResidentialListing({
        $,
        data: {
          domainAgencyID: this.agencyId,
          providerAdId: this.providerAdId,
          listingAction: this.listingAction,
          underOfferOrContract: this.underOfferOrContract,
          price: {
            from: this.fromPrice,
            to: this.toPrice,
          },
          description: this.description,
          features: this.features,
          propertyDetails: {
            propertyType: [
              this.propertyType,
            ],
            address: {
              streetNumber: this.streetNumber,
              unitNumber: this.unitNumber,
              street: this.street,
              state: this.state,
              suburb: this.suburb,
              postcode: this.postcode,
            },
          },
          receiveEmailsToDefaultAddress: this.receiveEmailsToDefaultAddress,
          isRural: this.isRural,
        },
      });
      $.export("$summary", `Created residential listing with ID: ${response.id}`);
      return response;
+   } catch (error) {
+     $.export("$summary", "Failed to create residential listing");
+     throw error;
+   }
  },
components/domain_group/actions/create-business-listing/create-business-listing.mjs (2)

130-130: Make type conversion more explicit

Using the unary plus operator (+) works but is less explicit than alternatives like Number(). Consider using a more explicit conversion method for better readability.

-        nabers: this.nabers && +this.nabers,
+        nabers: this.nabers && Number(this.nabers),

122-156: Add error handling to the run method

Similar to the residential listing component, consider adding explicit error handling for better user experience.

  async run({ $ }) {
+   try {
      const response = await this.domainGroup.createBusinessListing({
        $,
        data: {
          domainAgencyID: this.agencyId,
          providerAdId: this.providerAdId,
          listingAction: this.listingAction,
          underOfferOrContract: this.underOfferOrContract,
          nabers: this.nabers && +this.nabers,
          price: {
            from: this.fromPrice,
            to: this.toPrice,
          },
          description: this.description,
          features: this.features,
          propertyDetails: {
            propertyType: [
              this.propertyType,
            ],
            address: {
              streetNumber: this.streetNumber,
              unitNumber: this.unitNumber,
              street: this.street,
              state: this.state,
              suburb: this.suburb,
              postcode: this.postcode,
            },
          },
          receiveEmailsToDefaultAddress: this.receiveEmailsToDefaultAddress,
          isRural: this.isRural,
        },
      });
      $.export("$summary", `Created business listing with ID: ${response.id}`);
      return response;
+   } catch (error) {
+     $.export("$summary", "Failed to create business listing");
+     throw error;
+   }
  },
components/domain_group/domain_group.app.mjs (2)

45-50: Consider type consistency for nabers property

The nabers property is defined as a string here but is converted to a number in the business listing component. It might be clearer to define it as a number type to begin with, to ensure type consistency across the application.

  nabers: {
-   type: "string",
+   type: "integer",
    label: "NABERS",
    description: "The NABERS Rating is the energy efficiency rating that the property has been measured to have. This rating is measured in increments of .5 and can range from 0 to 6. The NABERS rating is required for spaces within office buildings of 1000 square metres or more. For more information on the NABERS rating system please visit [http://www.nabers.gov.au](http://www.nabers.gov.au)",
    optional: true,
  },

157-177: Note API version difference for commercial listings

The commercial listing endpoint uses API v2 while business and residential use v1. This appears intentional based on the documentation URL shown in the residential listing component, but it's worth documenting why there's a version difference.

Consider adding a comment above the createCommercialListing method explaining why it uses v2 instead of v1.

  createCommercialListing(opts = {}) {
+   // Using v2 endpoint as required by Domain Group API for commercial listings
    return this._makeRequest({
      method: "PUT",
      path: "/v2/listings/commercial",
      ...opts,
    });
  },
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between a654c74 and ca00e60.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (10)
  • components/domain_group/actions/create-business-listing/create-business-listing.mjs (1 hunks)
  • components/domain_group/actions/create-commercial-listing/create-commercial-listing.mjs (1 hunks)
  • components/domain_group/actions/create-residential-listing/create-residential-listing.mjs (1 hunks)
  • components/domain_group/common/property-types.mjs (1 hunks)
  • components/domain_group/domain_group.app.mjs (1 hunks)
  • components/domain_group/package.json (2 hunks)
  • components/domain_group/sources/agency-listing-updated/agency-listing-updated.mjs (1 hunks)
  • components/domain_group/sources/common/base.mjs (1 hunks)
  • components/domain_group/sources/new-agency-created/new-agency-created.mjs (1 hunks)
  • components/domain_group/sources/new-agency-listing-created/new-agency-listing-created.mjs (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Publish TypeScript components
  • GitHub Check: pnpm publish
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Lint Code Base
🔇 Additional comments (16)
components/domain_group/package.json (2)

3-3: Version bump looks appropriate.

The version update from 0.0.1 to 0.1.0 correctly follows semantic versioning principles for introducing new features without breaking existing functionality.


15-16: Dependencies addition is appropriate.

Adding the @pipedream/platform dependency is necessary for the new components being introduced in this PR. The version constraint (^3.0.3) follows best practices by allowing compatible updates.

components/domain_group/sources/new-agency-created/new-agency-created.mjs (1)

3-29: Module structure looks good.

The source module is well-structured with appropriate metadata, version, and description. The documentation link provides helpful context for users.

components/domain_group/common/property-types.mjs (4)

1-214: Comprehensive business types list.

The BUSINESS_TYPES constant provides a thorough list of business categories for validation purposes, which will help ensure data consistency when creating business listings.


216-253: Well-defined residential property types.

The RESIDENTIAL_TYPES constant appropriately defines the various residential property categories, which will be useful for creating residential listings.


255-282: Comprehensive commercial property types.

The COMMERCIAL_TYPES constant includes a thorough list of commercial property categories, which provides good validation options for commercial listings.


284-288: Clean export structure.

The exports are well-organized, making it easy for other modules to import specific constants as needed.

components/domain_group/sources/agency-listing-updated/agency-listing-updated.mjs (3)

3-11: Module metadata is well-defined.

The source module has appropriate key, name, description, version, and type definitions. The documentation link is helpful for users who need more information.


11-19: Props structure looks good.

The component properly extends the common props and adds the specific agencyId property that's needed for this particular source.


21-47: Well-implemented methods for tracking updates.

The methods are well-structured for tracking listing updates:

  • getResourceFn returns the correct API function
  • getArgs properly handles filtering by update date
  • getTsField specifies the correct timestamp field
  • generateMeta creates a unique ID that includes both the listing ID and timestamp

This implementation will effectively detect and emit events for updated listings.

components/domain_group/sources/common/base.mjs (1)

24-26: Confirm usage of an empty args object
getArgs() currently always returns an empty object. If you plan to differentiate fetching logic based on user inputs or config in the future, consider adding placeholders or optional parameters to ensure future scalability.

components/domain_group/sources/new-agency-listing-created/new-agency-listing-created.mjs (2)

3-19: Good reuse of the base module
Merging ...common props and methods ensures DRY code. Confirm that you only override or extend where necessary, avoiding duplication.


20-46: Check parameter vs. timestamp field consistency
getTsField() returns "dateCreated", but getArgs(lastTs) applies dateUpdatedSince in args.params. If you intend to detect newly created listings by their creation timestamp, confirm that “dateUpdatedSince” is the correct query param for listing creation events.

components/domain_group/actions/create-residential-listing/create-residential-listing.mjs (1)

1-150: Well-structured component with good organization

The residential listing creation component follows good practices with proper separation of concerns, clear property definitions, and a straightforward implementation.

components/domain_group/domain_group.app.mjs (2)

6-126: Well-defined property definitions with clear labels and descriptions

The property definitions are comprehensive with appropriate types, labels, and descriptions that will provide good guidance for users.


178-202:

❓ Verification inconclusive

Verify the pagination logic works as expected with the API

The current pagination implementation assumes that when the returned items length is 0, there are no more pages. Verify that this is how the Domain Group API indicates the end of pagination.


🏁 Script executed:

#!/bin/bash
# Check the Domain Group API documentation or sample responses to confirm pagination behavior

# Use a single example endpoint to see if we can find documentation about their pagination approach
curl -s "https://developer.domain.com.au/docs/latest" | grep -A 5 -B 5 "pagination"

Length of output: 81


Manual verification required: Confirm API pagination behavior

The current pagination implementation in components/domain_group/domain_group.app.mjs (lines 178‑202) assumes that an empty array returned by the API indicates there are no more pages. Since our initial attempt to retrieve documentation via the curl command produced no output, it’s unclear whether this assumption holds true for the Domain Group API.

  • Please manually verify that the API returns an empty list (or another suitable indicator) when there are no additional items/pages.
  • If possible, check actual API responses (e.g., via API manual testing) or consult updated API documentation to confirm that pagination ends when items length is 0.

@michelle0927 michelle0927 merged commit ed81fb5 into master Mar 18, 2025
11 checks passed
@michelle0927 michelle0927 deleted the issue-15747 branch March 18, 2025 14:16
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.

[Components] domain_group

3 participants