-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New Components - domain_group #15932
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
157 changes: 157 additions & 0 deletions
157
components/domain_group/actions/create-business-listing/create-business-listing.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,157 @@ | ||
| import domainGroup from "../../domain_group.app.mjs"; | ||
| import { BUSINESS_TYPES } from "../../common/property-types.mjs"; | ||
|
|
||
| export default { | ||
| key: "domain_group-create-business-listing", | ||
| name: "Create Business Listing", | ||
| description: "Creates a new business listing. [See the documentation](https://developer.domain.com.au/docs/latest/apis/pkg_listing_management/references/listings_upsertbusinesslisting/).", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| domainGroup, | ||
| agencyId: { | ||
| propDefinition: [ | ||
| domainGroup, | ||
| "agencyId", | ||
| ], | ||
| }, | ||
| providerAdId: { | ||
| propDefinition: [ | ||
| domainGroup, | ||
| "providerAdId", | ||
| ], | ||
| }, | ||
| propertyType: { | ||
| propDefinition: [ | ||
| domainGroup, | ||
| "propertyType", | ||
| ], | ||
| options: BUSINESS_TYPES, | ||
| }, | ||
| listingAction: { | ||
| propDefinition: [ | ||
| domainGroup, | ||
| "listingAction", | ||
| ], | ||
| }, | ||
| underOfferOrContract: { | ||
| propDefinition: [ | ||
| domainGroup, | ||
| "underOfferOrContract", | ||
| ], | ||
| }, | ||
| nabers: { | ||
| propDefinition: [ | ||
| domainGroup, | ||
| "nabers", | ||
| ], | ||
| }, | ||
| fromPrice: { | ||
| propDefinition: [ | ||
| domainGroup, | ||
| "fromPrice", | ||
| ], | ||
| }, | ||
| toPrice: { | ||
| propDefinition: [ | ||
| domainGroup, | ||
| "toPrice", | ||
| ], | ||
| }, | ||
| description: { | ||
| propDefinition: [ | ||
| domainGroup, | ||
| "description", | ||
| ], | ||
| }, | ||
| features: { | ||
| propDefinition: [ | ||
| domainGroup, | ||
| "features", | ||
| ], | ||
| }, | ||
| streetNumber: { | ||
| propDefinition: [ | ||
| domainGroup, | ||
| "streetNumber", | ||
| ], | ||
| }, | ||
| unitNumber: { | ||
| propDefinition: [ | ||
| domainGroup, | ||
| "unitNumber", | ||
| ], | ||
| }, | ||
| street: { | ||
| propDefinition: [ | ||
| domainGroup, | ||
| "street", | ||
| ], | ||
| }, | ||
| state: { | ||
| propDefinition: [ | ||
| domainGroup, | ||
| "state", | ||
| ], | ||
| }, | ||
| suburb: { | ||
| propDefinition: [ | ||
| domainGroup, | ||
| "suburb", | ||
| ], | ||
| }, | ||
| postcode: { | ||
| propDefinition: [ | ||
| domainGroup, | ||
| "postcode", | ||
| ], | ||
| }, | ||
| receiveEmailsToDefaultAddress: { | ||
| propDefinition: [ | ||
| domainGroup, | ||
| "receiveEmailsToDefaultAddress", | ||
| ], | ||
| }, | ||
| isRural: { | ||
| propDefinition: [ | ||
| domainGroup, | ||
| "isRural", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| 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; | ||
| }, | ||
| }; |
231 changes: 231 additions & 0 deletions
231
components/domain_group/actions/create-commercial-listing/create-commercial-listing.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,231 @@ | ||
| import domainGroup from "../../domain_group.app.mjs"; | ||
| import { COMMERCIAL_TYPES } from "../../common/property-types.mjs"; | ||
|
|
||
| export default { | ||
| key: "domain_group-create-commercial-listing", | ||
| name: "Create Commercial Listing", | ||
| description: "Creates a new commercial listing. [See the documentation](https://developer.domain.com.au/docs/latest/apis/pkg_listing_management/references/listings_upsertcommerciallisting/).", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| domainGroup, | ||
| agencyId: { | ||
| propDefinition: [ | ||
| domainGroup, | ||
| "agencyId", | ||
| ], | ||
| }, | ||
| providerAdId: { | ||
| propDefinition: [ | ||
| domainGroup, | ||
| "providerAdId", | ||
| ], | ||
| }, | ||
| propertyType: { | ||
| propDefinition: [ | ||
| domainGroup, | ||
| "propertyType", | ||
| ], | ||
| options: COMMERCIAL_TYPES, | ||
| }, | ||
| listingAction: { | ||
| propDefinition: [ | ||
| domainGroup, | ||
| "listingAction", | ||
| ], | ||
| reloadProps: true, | ||
| }, | ||
| underOfferOrContract: { | ||
| propDefinition: [ | ||
| domainGroup, | ||
| "underOfferOrContract", | ||
| ], | ||
| }, | ||
| nabers: { | ||
| propDefinition: [ | ||
| domainGroup, | ||
| "nabers", | ||
| ], | ||
| }, | ||
| description: { | ||
| propDefinition: [ | ||
| domainGroup, | ||
| "description", | ||
| ], | ||
| }, | ||
| features: { | ||
| propDefinition: [ | ||
| domainGroup, | ||
| "features", | ||
| ], | ||
| }, | ||
| streetNumber: { | ||
| propDefinition: [ | ||
| domainGroup, | ||
| "streetNumber", | ||
| ], | ||
| }, | ||
| unitNumber: { | ||
| propDefinition: [ | ||
| domainGroup, | ||
| "unitNumber", | ||
| ], | ||
| }, | ||
| street: { | ||
| propDefinition: [ | ||
| domainGroup, | ||
| "street", | ||
| ], | ||
| }, | ||
| state: { | ||
| propDefinition: [ | ||
| domainGroup, | ||
| "state", | ||
| ], | ||
| }, | ||
| suburb: { | ||
| propDefinition: [ | ||
| domainGroup, | ||
| "suburb", | ||
| ], | ||
| }, | ||
| postcode: { | ||
| propDefinition: [ | ||
| domainGroup, | ||
| "postcode", | ||
| ], | ||
| }, | ||
| areaValue: { | ||
| type: "string", | ||
| label: "Area Value", | ||
| description: "The size of the area in the commercial listing", | ||
| }, | ||
| areaUnit: { | ||
| type: "string", | ||
| label: "Area Unit", | ||
| description: "The unit of measure of the area value", | ||
| options: [ | ||
| "squareMetres", | ||
| "acres", | ||
| "hectares", | ||
| "squareFeet", | ||
| "squareYards", | ||
| "squares", | ||
| ], | ||
| }, | ||
| receiveEmailsToDefaultAddress: { | ||
| propDefinition: [ | ||
| domainGroup, | ||
| "receiveEmailsToDefaultAddress", | ||
| ], | ||
| }, | ||
| isRural: { | ||
| propDefinition: [ | ||
| domainGroup, | ||
| "isRural", | ||
| ], | ||
| }, | ||
| occupancyType: { | ||
| type: "string", | ||
| label: "Occupancy Type", | ||
| description: "The occupancy type of the listing", | ||
| options: [ | ||
| "tenanted", | ||
| "vacant", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| }, | ||
| additionalProps() { | ||
| const props = {}; | ||
| if (!this.listingAction) { | ||
| return props; | ||
| } | ||
|
|
||
| const saleFromPrice = { | ||
| type: "integer", | ||
| label: "Sale - From Price", | ||
| description: "Lowest price the property is expected to sell for to set search price. For a fixed price, set this value the same as To Price", | ||
| }; | ||
| const saleToPrice = { | ||
| type: "integer", | ||
| label: "Sale - To Price", | ||
| description: "Highest price the property is expected to sell for to set search price. For a fixed price, set this value the same as From Price", | ||
| }; | ||
| const leaseFromPrice = { | ||
| type: "integer", | ||
| label: "Lease - From Price", | ||
| description: "Lowest price the property is expected to rent for to set search price. For a fixed price, set this value the same as To Price", | ||
| }; | ||
| const leaseToPrice = { | ||
| type: "integer", | ||
| label: "Lease - To Price", | ||
| description: "Highest price the property is expected to rent for to set search price. For a fixed price, set this value the same as From Price", | ||
| }; | ||
|
|
||
| if (this.listingAction === "sale") { | ||
| props.saleFromPrice = saleFromPrice; | ||
| props.saleToPrice = saleToPrice; | ||
| } | ||
| if (this.listingAction === "rent") { | ||
| props.leaseFromPrice = leaseFromPrice; | ||
| props.leaseToPrice = leaseToPrice; | ||
| } | ||
| if (this.listingAction === "saleAndLease") { | ||
| props.saleFromPrice = saleFromPrice; | ||
| props.saleToPrice = saleToPrice; | ||
| props.leaseFromPrice = leaseFromPrice; | ||
| props.leaseToPrice = leaseToPrice; | ||
| } | ||
|
|
||
| return props; | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.domainGroup.createCommercialListing({ | ||
| $, | ||
| data: { | ||
| domainAgencyID: this.agencyId, | ||
| providerAdId: this.providerAdId, | ||
| nabers: this.nabers, | ||
| listingAction: this.listingAction, | ||
| underOfferOrContract: this.underOfferOrContract, | ||
| salePrice: this.saleFromPrice | ||
| ? { | ||
| from: this.saleFromPrice, | ||
| to: this.saleToPrice, | ||
| } | ||
| : undefined, | ||
| leasePrice: this.leaseFromPrice | ||
| ? { | ||
| from: this.leaseFromPrice, | ||
| to: this.leaseToPrice, | ||
| } | ||
| : undefined, | ||
| 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, | ||
| }, | ||
| area: { | ||
| value: +this.areaValue, | ||
| unit: this.areaUnit, | ||
| }, | ||
| }, | ||
| receiveEmailsToDefaultAddress: this.receiveEmailsToDefaultAddress, | ||
| isRural: this.isRural, | ||
| occupancyType: this.occupancyType, | ||
| }, | ||
| }); | ||
| $.export("$summary", `Created commercial listing with ID: ${response.id}`); | ||
| return response; | ||
| }, | ||
| }; | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.